Make reading shell environment a bit more robust
Now ensure that --login flag is not duplicated. Also run the shell in --interactive as well as --login mode.
This commit is contained in:
parent
f692d586f7
commit
6f83f76d41
@ -623,8 +623,12 @@ def read_shell_environment(opts: Optional[Options] = None) -> Dict[str, str]:
|
||||
shell = resolved_shell(opts)
|
||||
master, slave = openpty()
|
||||
remove_blocking(master)
|
||||
if '-l' not in shell and '--login' not in shell:
|
||||
shell += ['-l']
|
||||
if '-i' not in shell and '--interactive' not in shell:
|
||||
shell += ['-i']
|
||||
try:
|
||||
p = subprocess.Popen(shell + ['-l', '-c', 'env'], stdout=slave, stdin=slave, stderr=slave, start_new_session=True, close_fds=True)
|
||||
p = subprocess.Popen(shell + ['-c', 'env'], stdout=slave, stdin=slave, stderr=slave, start_new_session=True, close_fds=True)
|
||||
except FileNotFoundError:
|
||||
log_error('Could not find shell to read environment')
|
||||
return ans
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user