4

I have a simple nodeJS app that has a function to scrape file metadata. Since scraping metadata can be intensive I made the app run this as a child process using fork.

const metaParser = child.fork(  fe.join(__dirname, 'parse-metadata.js'), [jsonLoad]);

Everything worked great until I ported this to electron. When run in main.js the process is successfully created, but immediately exits. I added some logging to parse-metadata.js and found out that parse-metadata.js executed successfully and ran long enough to run the first few lines of code and then exited.

How do I get electron to fork parse-metadata.js and keep it alive until the end?

I'm using electron v1.4.15 and Node v6

iros
  • 127
  • 2
  • 11

1 Answers1

1

When using the detached option to start a long-running process, the process will not stay running in the background unless it is provided with a stdio configuration that is not connected to the parent. Also it seems related to the env.

Look at this: https://github.com/electron/electron/issues/6868

Rocco Musolino
  • 610
  • 10
  • 22