Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.36k stars 2.61k forks source link

How to use `--wait-ready` for non node-js programs ? #5775

Open deepakg202 opened 6 months ago

deepakg202 commented 6 months ago

I have a web server in dart which takes some time to start. How do i call process.send('ready') from the dart program ?

Currently I am using a workaround of running a nodejs file which is a wrapper to run the dart server and calling process.send from there. Is there any better way of doing this ?

ultimate-tester commented 6 months ago

So pm2 would be a manager for NodeJS, not for other application types. It can probably be abused to make your use case work, but that doesn't mean it's supported. With this I'm trying to say: find something specific for Dart.

Having said that, the process.send method uses an IPC channel to communicate to its parent (if any). Dart does not have cross OS IPC so you'd need to find or make your own implementation. If your target OS is Linux, you go with Domain Sockets and if your OS is windows you go with named pipes.

Where the domain socket is located or what is the name of the named pipe for NodeJS I'm not sure. You'll need to hijack it and then mimic the process.send method that way to accomplish what you want.

But again, you should find a different solution than PM2 for dart applications.