Inconsistent spawnProcess id
robtoll opened this issue · 1 comments
Hi great app. Well done to the team! Small bug...
When I spawn 2 processes as per your documentation, they both have the same id.
I don't mean pid, I mean the id of the spawned process, as returned by "getSpawnedProcesses".
Your documentation says the following...
await Neutralino.os.spawnProcess('ping neutralino.js.org');
await Neutralino.os.spawnProcess('ping codezri.org');
let processes = await Neutralino.getSpawnedProcesses();
console.log(processes); // returns [{id:0, pid:xxxx},[{id:1, pid:xxxx}]
Firstly, the line that gets the processes is missing ".os"...
await Neutralino.os.getSpawnedProcesses();
The documentation needs to be updated.
When I run the code, it returns 2 processes with their own unique ID.
But if I name the 2 processes then run getSpawnedProcesses it returns only 1 item...
proc1 = await Neutralino.os.spawnProcess('ping neutralino.js.org');
proc2 = await Neutralino.os.spawnProcess('ping codezri.org');
let processes = await Neutralino.getSpawnedProcesses();
console.log(processes); // returns [{id:0, pid:xxxx}]
The processes both work but share the same spawn id, which is impossibel to use because they share the same stdin stdout and stderr.
I work around this by running the "getSpawnedProcesses" function after each process is spawned.
This somehow keeps it in check...
proc1 = await Neutralino.os.spawnProcess('ping neutralino.js.org');
let processes = await Neutralino.getSpawnedProcesses();
console.log(processes); // returns [{id:0, pid:xxxx}]
proc2 = await Neutralino.os.spawnProcess('ping codezri.org');
let processes = await Neutralino.getSpawnedProcesses();
console.log(processes); // returns [{id:0, pid:xxxx},[{id:1, pid:xxxx}]
I'm on winx64 - the config file says
"binaryVersion": "4.7.0",
"clientVersion": "3.6.0"
Cheers
Hi all! I also encountered this bug. If I run several processes at the same time, then some of them get the same id (Neutralino-scoped process identifier). Also, there is no process pid in the spawnedProcess event, but it is specified in the release https://github.com/neutralinojs/neutralinojs/releases/tag/v4.6.0