I'm spawning a process with child_process.spawn(). How can I view the exact command line that is executed (including all command-line parameters passed into the spawn function)?
Here's my example that isn't working:
var s = require('child_process');
var p = s.spawn('ffmpeg', ['-probesize 1024', '-i "rtsp://192.168.1.10:554/11"', 'test.h264']);
When I capture the stderr, I get a message "Unrecognized option 'probesize 1024'. However, if I run ffmpeg from the command line, it works fine. So I need to see exactly how the command-line options are being mangled before being sent to FFMPEG in order to debug this.
Thanks
Try
var p = s.spawn('ffmpeg', [
'-probesize',
'1024',
'-i',
'rtsp://192.168.1.10:554/11',
'test.h264'
]);
Command line arguments that have a space between them but are coherent, still need to be separated. So there's needs to be a space between -probesize
and 1024
Update
If you would like to keep the coherent arguments together, add shell: true
to the options object:
var p = s.spawn('ffmpeg',
[
'-probesize 1024',
'-i "rtsp://192.168.1.10:554/11"',
'test.h264'
],
{
shell: true
}
);