Handle deprecated calls to child_process with args

This commit is contained in:
Nick O'Leary
2025-07-04 14:59:58 +01:00
parent aadbbc96ee
commit b364f8f9b6
4 changed files with 20 additions and 4 deletions

View File

@@ -57,7 +57,15 @@ module.exports = {
return new Promise((resolve, reject) => {
let stdout = "";
let stderr = "";
const child = child_process.spawn(command,args,options);
let child
if (args && options.shell) {
// If we are using a shell, we need to join the args into a single string
// as passing a separate array of args is deprecated in Node 24
command = [command].concat(args).join(" ");
child = child_process.spawn(command, options)
} else {
child = child_process.spawn(command, args, options);
}
child.stdout.on('data', (data) => {
const str = ""+data;
stdout += str;