Skip to content

fix(terminal): skip -l login flag for csh and tcsh#12403

Open
serhiizghama wants to merge 1 commit into
continuedev:mainfrom
serhiizghama:fix/tcsh-shell-login-flag
Open

fix(terminal): skip -l login flag for csh and tcsh#12403
serhiizghama wants to merge 1 commit into
continuedev:mainfrom
serhiizghama:fix/tcsh-shell-login-flag

Conversation

@serhiizghama
Copy link
Copy Markdown

@serhiizghama serhiizghama commented May 13, 2026

Problem

When $SHELL is set to tcsh (or csh), every terminal command issued by Continue fails immediately:

Unknown option: `-l'
Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ].
Command failed with exit code 1

getShellCommand in both core/tools/implementations/runTerminalCommand.ts and extensions/cli/src/tools/runTerminalCommand.ts hardcodes ["-l", "-c", command] for every Unix shell. csh and tcsh do not accept -l as a flag, so the shell rejects the invocation before the command is ever evaluated.

Fixes #12378.

Solution

Detect the shell binary name (basename of $SHELL) and omit the -l flag when it is csh or tcsh. Those shells automatically source ~/.cshrc / ~/.tcshrc on 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") returns args: ["-l", "-c", "echo hi"] (unchanged).
  • tcsh / csh: getShellCommand("echo hi") returns args: ["-c", "echo hi"], which tcsh -c "echo hi" accepts and runs normally.
  • Manual repro from the issue ($SHELL=/bin/tcsh, ask Continue to run pwd) now succeeds instead of erroring with Unknown option: -l.

Summary by cubic

Skip the -l login flag when invoking csh/tcsh so terminal commands don’t fail with “Unknown option: -l.” Other shells keep using -l -c to load shell configs.

  • Bug Fixes
    • Detect the shell name and omit -l for csh/tcsh, which auto-source their rc files.
    • Added a small helper to compute login args and applied it in both terminal command implementations (Unix/macOS and WSL paths); bash/zsh behavior unchanged.

Written for commit 1ae4cab. Summary will update on new commits.

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
@serhiizghama serhiizghama requested a review from a team as a code owner May 13, 2026 20:08
@serhiizghama serhiizghama requested review from sestinj and removed request for a team May 13, 2026 20:08
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Terminal commands fail when $SHELL is set to tcsh due to hardcoded -l shell flag

1 participant