mirror of
https://github.com/markqvist/rnsh.git
synced 2026-01-10 20:41:14 -05:00
Enhance shell fallback mechanism and improve environment variable handling
- Updated the listener to ensure a default shell of /bin/sh is used if the shell lookup fails or returns an empty value. - Modified the session to set a default TERM environment variable to "xterm" if none is provided, improving compatibility across different environments.
This commit is contained in:
parent
b114b190bd
commit
edb2562b35
2 changed files with 5 additions and 2 deletions
|
|
@ -158,7 +158,10 @@ async def listen(configdir, command, identitypath=None, service_name=None, verbo
|
|||
except Exception as e:
|
||||
log.error(f"Error looking up shell: {e}")
|
||||
log.info(f"Using {shell} for default command.")
|
||||
_cmd = [shell] if shell else None
|
||||
# Ensure a sane shell default. Fall back to /bin/sh if lookup fails.
|
||||
if not shell or len(shell) == 0:
|
||||
shell = "/bin/sh"
|
||||
_cmd = [shell]
|
||||
else:
|
||||
log.info(f"Using command {shlex.join(_cmd)}")
|
||||
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ class ListenerSession:
|
|||
|
||||
try:
|
||||
self.process = process.CallbackSubprocess(argv=self.cmdline,
|
||||
env={"TERM": self.term or os.environ.get("TERM", None),
|
||||
env={"TERM": self.term or os.environ.get("TERM") or "xterm",
|
||||
"RNS_REMOTE_IDENTITY": (RNS.prettyhexrep(self.remote_identity.hash)
|
||||
if self.remote_identity and self.remote_identity.hash else "")},
|
||||
loop=self.loop,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue