Skip to content

integrated terminal assumes GNU bash is used as user shell, passes --login #123332

@mirabilos

Description

@mirabilos
  • VS Code Version: unclear, but the user upgraded it recently
  • OS Version: unclear, but some kind of Unix or GNU

Steps to Reproduce:

  1. set the user shell to mksh
  2. try to use the integrated terminal

I’m the developer of mksh, a Unix Korn Shell. I’m proxying this bugreport for an mksh user.

The user receives the error The terminal process "/usr/local/bin/mksh '--login'" failed to launch (exit code: 1). This is because, apparently, vscode forcibly adds the flag --login, which only exists in GNU bash, to shell invocations, which is wrong.

Many shells have flags to indicate to them they are the login shell, but most often this is -l instead, so if you do an execv("/path/to/shell", "/path/to/shell", "-l", NULL); they would work, but that would also be wrong (even if that’d work with both GNU bash and mksh).

The proper way to ask a shell to be a login shell is to prepend a hyphen-minus to its zero-th argument, that is: execv("/path/to/shell", "-shell", NULL);
You can also prepend the hyphen-minus to the full path: execv("/path/to/shell", "-/path/to/shell", NULL);

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions