I am trying to spawn a child process with a default directory. The process is being executed and it is able to read the args. But the process starts up in the current directory, even though I am providing cwd as options. Am I doing this incorrectly?
var spawn = require('child_process').spawn;
var child = spawn("sh",
   ["path_to_file_name", "args"],
   [{cwd:"/some/path/temp"}]
);
My end goal is to execute a bash script, in a specific folder so that it doesn't mess up my application directory.
Node version : 4.0.0
options is an object, not array.
var child = spawn("sh",
   ["path_to_file_name", "args"],
   {cwd:"/some/path/temp"}
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With