fix(terminal): skip -l login flag for csh and tcsh#12403
Open
serhiizghama wants to merge 1 commit into
Open
Conversation
csh and tcsh do not accept -l as a flag, causing every terminal command to fail with 'Unknown option: -l' when $SHELL points to one of them. Detect the shell name and only pass -l when the shell is known to support it. csh and tcsh automatically source their rc files on every invocation, so login shell behavior is preserved. Fixes continuedev#12378
Contributor
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When
$SHELLis set totcsh(orcsh), every terminal command issued by Continue fails immediately:getShellCommandin bothcore/tools/implementations/runTerminalCommand.tsandextensions/cli/src/tools/runTerminalCommand.tshardcodes["-l", "-c", command]for every Unix shell.cshandtcshdo not accept-las a flag, so the shell rejects the invocation before the command is ever evaluated.Fixes #12378.
Solution
Detect the shell binary name (
basenameof$SHELL) and omit the-lflag when it iscshortcsh. Those shells automatically source~/.cshrc/~/.tcshrcon every invocation, so the login-shell intent (sourcing rc files) is preserved without the flag.Behavior is unchanged for bash, zsh, sh, fish, and any other shell — they continue to receive
-l -c <command>.Testing
bash/zsh:getShellCommand("echo hi")returnsargs: ["-l", "-c", "echo hi"](unchanged).tcsh/csh:getShellCommand("echo hi")returnsargs: ["-c", "echo hi"], whichtcsh -c "echo hi"accepts and runs normally.$SHELL=/bin/tcsh, ask Continue to runpwd) now succeeds instead of erroring withUnknown option: -l.Summary by cubic
Skip the
-llogin flag when invokingcsh/tcshso terminal commands don’t fail with “Unknown option: -l.” Other shells keep using-l -cto load shell configs.-lforcsh/tcsh, which auto-source their rc files.bash/zshbehavior unchanged.Written for commit 1ae4cab. Summary will update on new commits.