Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent spawnProcess id #64

Open
robtoll opened this issue Nov 4, 2022 · 1 comment
Open

Inconsistent spawnProcess id #64

robtoll opened this issue Nov 4, 2022 · 1 comment

Comments

@robtoll
Copy link

robtoll commented Nov 4, 2022

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

@rpu6HuK87
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants