Skip to content

Commit a222bd3

Browse files
committed
docs: document shell resolution
1 parent 269ed93 commit a222bd3

3 files changed

Lines changed: 55 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ Check out documentation and other usage examples in the [`docs` directory](./doc
9797
- `options` (optional): an object containing any of the below:
9898
- `cwd`: the working directory to be used by all commands. Can be overridden per command.
9999
Default: `process.cwd()`.
100+
- `shell`: shell executable used to run command strings. When unset, uses `npm_config_script_shell` if present (for example when run via `npm run`), otherwise `cmd.exe` on Windows or `/bin/sh` elsewhere. See [shell resolution](./docs/shell-resolution.md).
100101
- `defaultInputTarget`: the default input target when reading from `inputStream`.
101102
Default: `0`.
102103
- `handleInput`: when `true`, reads input from `process.stdin`.

docs/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Concurrently Documentation
22

3+
## General
4+
5+
These articles apply when using either concurrently's CLI or API:
6+
7+
- [Shell Resolution](./shell-resolution.md)
8+
39
## CLI
410

511
These articles cover using concurrently through CLI:

docs/shell-resolution.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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

Comments
 (0)