-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Closed
Copy link
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
Description
- Version: 8.9.4
- Platform: n/a
- Subsystem: child_process
The shell option for the execFile and execFileSync functions in the child_process module is not documented. However, it clearly works, as this mocha/chai test proves:
const { execFile, execFileSync } = require('child_process')
const expect = require('chai').expect
const EXEC_OPTS = { encoding: 'utf8', shell: process.env.SHELL }
describe('execFile()', () => {
it('should run command using specified shell', async () => {
let fn
try {
const result = await new Promise((resolve, reject) => {
execFile('ls', ['*'], EXEC_OPTS, (err, stdout) =>
err ? reject(err) : resolve(stdout))
})
fn = () => result
} catch (err) {
fn = () => { throw err }
}
expect(fn).to.not.throw()
})
})
describe('execFileSync()', () => {
it('should run command using specified shell', () => {
expect(() => execFileSync('ls', ['*'], EXEC_OPTS)).to.not.throw()
})
})
I'm happy to add documentation for this option. I just need to know if this behavior is intention or whether it's the result of leaky internals.
Metadata
Metadata
Assignees
Labels
child_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.