exec: specify shell to run the command in
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the enhancement
Add an option to exec.exec to invoke a specific shell, e.g. /bin/bash, when running the command.
Alternatively, document that exec.exec does not invoke a shell by default.
Code Snippet
Currently:
await exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`])
Better:
await exec.exec('cp', ['-a', '/Volumes/Julia-*/Julia-*.app/Contents/Resources/julia', `${process.env.HOME}/julia`], {'shell': '/bin/bash'})
Additional information
The docs say that "you can use this package to execute your tools on the command line in a cross platform way". To me that implies it invokes a shell, which it doesn't. This misunderstanding has caused me quite the headache when I tried to find out why cp wasn't working with wildcards.
Disclaimer: I have almost zero experience with Typescript, perhaps this behaviour is obvious to people who regularly use it. 🤷♂
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/exec/src/interfaces.ts at the linked exec options definition and inspect how exec.exec currently launches commands. Compare the requested shell option with the alternative of documenting the no-shell behavior, then check the exec package's existing tests and documentation. Done means the chosen behavior is implemented or clearly documented, with coverage for the command invocation behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100