-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Description
- Version: v9.10.1+
- Platform: Darwin
- Subsystem: child_process
const cp = require('child_process');
const pwd = cp.spawn('pwd', undefined, { cwd: '/' })
pwd.stdout.on('data', data => console.log(data.toString()));
admin$ pwd
/tmp
admin$ node test.js
/tmp
I know how to fix it, just pass an empty array as a second argument, or completely skip it.
But that behavior a little bit weird, the second parameter (args) is optional, so I guessed undefined
is okay for it.
When using TypeScript some IDEs suggests that undefined
value could be passed (cuz param is optional) and that's why in my project I passed undefined
to it and got a weird program behavior.
Metadata
Metadata
Assignees
Labels
No labels