Also set cwd when piping to none
This commit is contained in:
parent
a8504c971a
commit
55969bc3c5
@ -11,7 +11,7 @@ from functools import partial
|
|||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from weakref import WeakValueDictionary
|
from weakref import WeakValueDictionary
|
||||||
|
|
||||||
from .child import cached_process_data
|
from .child import cached_process_data, cwd_of_process
|
||||||
from .cli import create_opts, parse_args
|
from .cli import create_opts, parse_args
|
||||||
from .conf.utils import to_cmdline
|
from .conf.utils import to_cmdline
|
||||||
from .config import initial_window_size_func, prepare_config_file_for_editing
|
from .config import initial_window_size_func, prepare_config_file_for_editing
|
||||||
@ -918,10 +918,14 @@ class Boss:
|
|||||||
else:
|
else:
|
||||||
import subprocess
|
import subprocess
|
||||||
env, stdin = self.process_stdin_source(stdin=source, window=window)
|
env, stdin = self.process_stdin_source(stdin=source, window=window)
|
||||||
|
cwd = None
|
||||||
|
if cwd_from:
|
||||||
|
with suppress(Exception):
|
||||||
|
cwd = cwd_of_process(cwd_from)
|
||||||
if stdin:
|
if stdin:
|
||||||
r, w = safe_pipe(False)
|
r, w = safe_pipe(False)
|
||||||
try:
|
try:
|
||||||
subprocess.Popen(cmd, env=env, stdin=r)
|
subprocess.Popen(cmd, env=env, stdin=r, cwd=cwd)
|
||||||
except Exception:
|
except Exception:
|
||||||
os.close(w)
|
os.close(w)
|
||||||
else:
|
else:
|
||||||
@ -929,7 +933,7 @@ class Boss:
|
|||||||
finally:
|
finally:
|
||||||
os.close(r)
|
os.close(r)
|
||||||
else:
|
else:
|
||||||
subprocess.Popen(cmd, env=env)
|
subprocess.Popen(cmd, env=env, cwd=cwd)
|
||||||
|
|
||||||
def args_to_special_window(self, args, cwd_from=None):
|
def args_to_special_window(self, args, cwd_from=None):
|
||||||
args = list(args)
|
args = list(args)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user