- 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')constexpect=require('chai').expectconstEXEC_OPTS={encoding: 'utf8',shell: process.env.SHELL}describe('execFile()',()=>{it('should run command using specified shell',async()=>{letfntry{constresult=awaitnewPromise((resolve,reject)=>{execFile('ls',['*'],EXEC_OPTS,(err,stdout)=>err ? reject(err) : resolve(stdout))})fn=()=>result}catch(err){fn=()=>{throwerr}}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.
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:
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.