'How to use an absolute path in process.fork()?
I'm using a child process to run a long background task in one of my services. Dir structure looks like this:
/path/in/my/host/index.js
/path/in/my/host/worker.js
However, I'm using Docker to facilitate my deployment workflow. When running inside a Docker container, the path looks like this:
/path/in/my/container/index.js
/path/in/my/container/worker.js
When running my code, I'm getting the following error in the child process:
Uncaught Error Error: Cannot find module '/path/in/my/host/worker.js'
How can I make node's stdlib understand that it's running inside a container and use the proper cwd path? I have no idea why it's trying to use paths from the host. Since I'm running this from VSCode's debugger, maybe its injecting something in the child's env process, but then again, I couldn't tune the process creation to ignore those.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
