Friday 2 June 2017

How to pass cwd and arguments in node.js child process?

In node.js I want to pick a cwd and pass a string argument. I have this

const exec = cp.exec;
exec("logic_parser.exe", {cwd: '../logic_parser/logic_parser/bin/Debug/'}, ['read'], (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
  console.log(`stdout: ${stdout}`);
  console.log(`stderr: ${stderr}`);
});

But it complains about incorrect args.



via omega

No comments:

Post a Comment