BrandonZacharie / node-mongod

A MongoDB server manager for Node.js
MIT License
9 stars 4 forks source link

Trouble Forking Process #1

Open CaleCrawford opened 7 years ago

CaleCrawford commented 7 years ago

Hello Brandon,

First of all, thank you very much for this repo. Ever since moving away from grunt I have been trying to get something like this to work. I am having trouble with a few parts of it. Previously, I used https://www.npmjs.com/package/grunt-services to manage mongod and redis. With that package I was able to run each in a "forked" mode that ran in the background. I have tried using the mongod.conf file and setting

processManagement:    
      fork: true

This works to a degree. Mongod is started and is forked but none of the callbacks inside the promise run:

server.open().then(() => {
    # This will not run
    console.log("Mongo server started successfully");
});

The problem comes when I try and stop the process. If I run server.close((err) => { it says that it runs successfully but the process is not closed.

Any idea how to go about running in forked mode? Is there something that I am missing?

Thanks!

BrandonZacharie commented 7 years ago

AFAIK, fork: true creates a new process for mongod. The original process, where this library runs, does not get standard output from the forked process. This library relies exclusively on standard output from mongod in order to determine what's going on. If there's a way to get it from the forked process, this issue may be fixable.