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

spawnedProcess event - pid needed! #103

Open
ruslanx3m opened this issue Mar 2, 2024 · 3 comments
Open

spawnedProcess event - pid needed! #103

ruslanx3m opened this issue Mar 2, 2024 · 3 comments

Comments

@ruslanx3m
Copy link

ruslanx3m commented Mar 2, 2024

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

We need PID not ID (useless) !

{
  id: <id>,
  pid: <pid>,
  action: <action>,
  data: <data>
}

but we get only

{
  id: <id>,
  action: <action>,
  data: <data>
}
@abhaysinghs772
Copy link

hey @ruslanx3m could you please share your code snipppet in order reproduce this issue in my local system.
although it is working fine for me, i am getting pId in my case.
image

@ruslanx3m
Copy link
Author

ruslanx3m commented Apr 3, 2024

Hi, I need for event to return PID not ID ... ?!

let nodeProc = await Neutralino.os.spawnProcess('node');

Neutralino.events.on('spawnedProcess', (evt) => {  // no PID in evt
    if(nodeProc.id == evt.detail.id) {
        switch(evt.detail.action) {
            case 'stdOut':
                console.log(evt.detail.data); // 10
                break;
            case 'stdErr':
                console.error(evt.detail.data);
                break;
            case 'exit':
                console.log(`Node.js process terminated with exit code: ${evt.detail.data}`);
                break;
        }
    }
});

await Neutralino.os.updateSpawnedProcess(nodeProc.id, 'stdIn', 'console.log(5 + 5);');
await Neutralino.os.updateSpawnedProcess(nodeProc.id, 'stdInEnd');

image

@abhaysinghs772
Copy link

abhaysinghs772 commented Apr 8, 2024

@shalithasuranga, I think this is a bug,
Could you please confirm from your end as well?

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