open-cli-tools / open-cli-tools/concurrently

Add shell option / support `spawn` in configured api.

Open
#556 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.9k
Forks
281
Avg merge
17h 12m
Merged PRs (30d)
1

Description

The default spawn behavior on Windows is spawn with cmd.exe, which is reasonable for compatibility, but makes it hard to kill due to cmd.exe prompting with "Terminate batch job (Y/N)?" for each command; among other issues. In most cases using pwsh.exe would be preferred.

Similarly, the shell on other platforms is hard-coded to /bin/sh which is quite a bit more limited than may be expected.

Worse, this behavior is essentially already implemented in Node's native spawn() function since v5.7.0 as the { shell: true } option - which additionally accepts a string for the shell (which uses essentially execFile(options.shell, ["-c", command])).

In either case, users may prefer to use a shell emulator like @yarnpkg/shell to get portable behavior.

There is an undocumented spawn option which you can use to override this implementation, but only for the unconfigured createConcurrently option, the default configured export seemingly accidentally doesn't forward it to the underlying createConcurrently() - requiring the caller to re-implement the default behavior. Adding a single spawn: options.spawn line works fine. Perhaps the configured concurrently should use something like return createConcurrently(commands, { outputStream: process.stdout, ...options, controllers: [<existing>, ...options.controllers] }) to forward all options by default.

Alternatively, the API could expose a new shell or spawnOptions which would override the default shell behavior, or even a shellEmulator: boolean option (to match e.g. the pnpm equivalent option) which uses @yarnpkg/shell.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the configured concurrently export and createConcurrently() option forwarding, then inspect how the undocumented spawn option reaches the underlying implementation. Compare the existing behavior with Node's native spawn() shell option and the alternatives described in the issue. Done means the chosen shell or spawn configuration is exposed consistently through the configured API and covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.