neutralino.js icon indicating copy to clipboard operation
neutralino.js copied to clipboard

spawnedProcess event - pid needed!

Open ruslanx3m opened this issue 11 months ago • 3 comments

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>
}

ruslanx3m avatar Mar 02 '24 13:03 ruslanx3m

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

abhaysinghs772 avatar Mar 30 '24 18:03 abhaysinghs772

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

ruslanx3m avatar Apr 03 '24 15:04 ruslanx3m

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

abhaysinghs772 avatar Apr 08 '24 23:04 abhaysinghs772