I’m trying to open a file with an electron app and ‘watch’ it for any changes, etc.
I have tried using shell.openItem() which opens the item perfectly fine, but all it returns is true of false indicating the status of the command. However, I’d like to receive or find out the PID of the application that just got launched. Is this possible?
I also tried to use child_process.spawn() / child_process.exec() and had no success with either. If I try to get the PID using the child_process, it returns the wrong PID, im assuming because it returns the PID for the node process which isn’t what I want.
I also tried -Wait flag in the exec() command. In shell, if I add the -Wait command, it will wait until the application is closed however this does not work with electron. The process immediately ends with code 0. If I could make the node process wait instead of closing right away essentially I get what I want, if I watch the node process that is waiting for the application that it just launched to close, im technically watching that file that I opened. Once the node process ends, I can assume the launched file is now closed.
Does anyone have any ideas / tips on how I could achieve this?