Unitech/pm2 — pull request #271 by rlidwka (2014-01-28 12:31:58+00:00)
Title: option to launch pm2 daemon itself in the foreground

#259

> Yes would be interesting. Changing the way pm2 launch itself would be a quite big work.

I just did that big work. Woo-hoo. :)

> An alternative would be to not exit ? And instead printing on the standard output the pid of the pm2 daemon ?

The issue with it is that daemon is still backgrounded. Which means you can't view its logs, you can't stop it using ctrl-c, and well you have two processes running, one of which is useless.

I didn't thoroughly tested it, but I'm quite sure that the clean solution is possible, because node.js is awesome (since it's async, you can run independent apps in one process, i.e. CLI and daemon).

Warning: pull request depends on 63a24dd, so it is against development branch where that commit is pulled in.