New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support defaulting launch & proc-run to use $SHELL with option for --no-shell otherwise #28
Comments
It looks like we may actually need the login shell option. Bash, ksh, fish, and zsh support providing a login shell and command option together So idea would be to do something like |
Resolved by 160631b |
If you integrate libssh or libssh2, you can have the sshd give you a login shell by requesting a shell explicitly, and then you can send your commands on stdin, which is sort of in alignment with your comment above, but you shouldn't need to play around with Also note that if you were in control of the spawning directly (which I know you're not in this case), spawning a login shell can be done this way in rust: let shell = Self::get_shell()?;
let mut cmd = std::process::Command::new(&shell);
// Run the shell as a login shell by prefixing the shell's
// basename with `-` and setting that as argv0
let basename = shell.rsplit('/').next().unwrap_or(&shell);
cmd.arg0(&format!("-{}", basename)); https://github.com/wez/wezterm/blob/main/pty/src/cmdbuilder.rs#L190-L197 |
FWIW, the |
Good call out about fish :) If I get to the point of incorporating an ssh
client and have the control you mentioned, I'd definitely switch to that!
For now, fish users would include `--no-shell`
…On Mon, Aug 16, 2021, 6:02 PM Wez Furlong ***@***.***> wrote:
FWIW, the $SHELL -l thing doesn't work with fish; I know because that's
the technique I used to use in wezterm!
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#28 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAS55CSMOLVNJJQCKI2ABLLT5GKHXANCNFSM5CIIIEZA>
.
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
At least for launch (proc-run may not be necessary), being able to take advantage of the path assigned to a user would be handy.
Testing with
ssh <host> echo '$SHELL'
resulted in the right shell being printed, so that environment variable is available. It looks like the majority of shells support<shell> -l
for login and<shell> -c <command>
to run a command as non-login. Doesn't look like you can run a login shell and execute a command, but I don't think a login shell is necessary to get the path configured for the specific user as non-login will still source files like~/.bashrc
and others.Anyway, idea here is to default to attempting to run distant over ssh using
$SHELL -c distant ...
to have appropriate environment variables established. If--no-shell
is provided, then we wouldn't wrap in a$SHELL
call.Doing this for
proc-run
may not make sense as any environment given to the distant binary is passed on to its children; so, just providing launch with$SHELL
should pass on the results to the children as well.The text was updated successfully, but these errors were encountered: