|
| 1 | +# Shell Resolution |
| 2 | + |
| 3 | +Each command runs inside a shell, not as a bare executable. |
| 4 | +By default, concurrently uses `cmd.exe` on Windows and `/bin/sh` elsewhere. |
| 5 | + |
| 6 | +## Using a different shell |
| 7 | + |
| 8 | +If the default shell isn't suitable, it's possible to instruct concurrently to use a specific shell in a few ways. |
| 9 | + |
| 10 | +This is useful, for example, to use Unix-style syntax (for example `BROWSER=none npm start`) on Windows, if you set concurrently shell to e.g. Git Bash. |
| 11 | + |
| 12 | +### Via explicit override |
| 13 | + |
| 14 | +An explicit shell override takes precedence over every other configuration. |
| 15 | +To do that, pass the `--shell` flag to the CLI: |
| 16 | + |
| 17 | +```bash |
| 18 | +concurrently --shell "C:\Program Files\Git\bin\bash.exe" "echo Hello world | xargs -n 1 echo" |
| 19 | +``` |
| 20 | + |
| 21 | +Or via the API: |
| 22 | + |
| 23 | +```js |
| 24 | +concurrently(['echo Hello world | xargs -n 1 echo'], { |
| 25 | + shell: 'C:\\Program Files\\Git\\bin\\bash.exe', |
| 26 | +}); |
| 27 | +``` |
| 28 | + |
| 29 | +### Via npm/pnpm/yarn v1 |
| 30 | + |
| 31 | +When using npm, pnpm or yarn v1 to run concurrently via a `package.json` script, the |
| 32 | +[`script-shell` configuration](https://docs.npmjs.com/cli/v6/using-npm/config#script-shell) is inherited and used to spawn commands. |
| 33 | + |
| 34 | +```bash |
| 35 | +npm config set script-shell /bin/bash |
| 36 | +npm dev # Runs the dev script on bash. Concurrently will also run commands using bash. |
| 37 | +``` |
| 38 | + |
| 39 | +## Supported shells |
| 40 | + |
| 41 | +If you've specified a different shell, concurrently detects its kind and spawns commands |
| 42 | +using the right syntax for that shell. |
| 43 | + |
| 44 | +The following shell types are supported: |
| 45 | + |
| 46 | +- Windows `cmd.exe` |
| 47 | +- Powershell |
| 48 | +- Any POSIX compliant shells (bash, zsh, dash, etc) |
0 commit comments