-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Make it possible to select an alternative shell to use. #7837
Description
Motivation.
Currently, Goose uses the default shell to allow the model to control the computer. In most cases it is /bin/sh on Unix and cmd.exe on Windows.
There are two problems:
-
On a Unix, the model can assume that it has a bash as a shell and issue complex commands, which will not work if
/bin/shis actuallydashorash, but notbash. Also, it is possible that the user has a non-standard shell likezsh, etc... This can be confusing for the model. -
Especially critical for Windows:
cmd.exeis an almost unusable thing. You cannot do anything within it. And model too. Even when the model tries to run PowerShell (and in Windows we have two not fully compatible PowerShell versions...), model should deal with relatively complex rules to escape a wide set of symbols (to avoid special interpretation bycmd.exe). Actually, Windows shell is a total hell. And because of this, many people prefer using Cygwin and similar solutions. The same relates to the model: it has good knowledge of Unix shell, and it is much easier for the model to work within a Unix-like environment than in a Windows environment. Actually, a Windows environment is needed only for things like running the build: this is one-two special commands (which still can be run from cygwin). The native Windows shell (cmd.exe) is extremely inconvenient for both the model and the user.
Proposition
Implement new settings: preferred shell. The default value should be /bin/bash for Unix and cmd.exe for Windows. Users must have the possibility to change shell by specifying a binary executable (full path or only name, if executable available in PATH). The main scenario for Windows is that the user selects bash.exe from Cygwin as the main shell.
This feature cannot be implemented just by running commands as cmd.exe, /c, bash -c "Unix-command" (bash.exe must be started directly), because cmd.exe still interprets at least the following characters: %, ^ and ".