Open tallesl opened 9 years ago
+1
+1
I miss this feature as well.
+1
I'd love this as a feature!
would absolutely love this.
If @coreybutler could point us in the right direction, maybe one of us can see about making a PR for this feature?
For what I think people are generally wanting, the starting point is in the wrapper.js. This file essentially behaves like a command line app, and the lines referenced above are where the child process is launched. I believe this could be modified to support additional user-provided arguments.
One point I want to stress is cross-OS API consistency. While node-windows/mac/linux are separate repos, the overarching goal is to provide a consistent API, regardless of OS. The wrapper files of each project are very similar, and this particular use case is one I would want to see in all 3 wrappers.
If anyone decides to take this on, let me know. For one, I sincerely appreciate any assistance, and I'm happy to answer questions via Gitter or in this issue. It's certainly something I wouldn't have a problem merging so long as the cross-OS API consistency remains intact.
Thanks for the update. I'll look into wrapper.js, but additionally, I've found something else that seems to work: the Non-Sucking Service Manager (nssm.cc). The name is terrible, but the system works nicely. Basically, it allows you to configure whatever you want (like node, with the appropriate command line parameters) specifying whatever start directory you want (e.g. your project's directory). It then sets up a Windows service to call up an instance of itself with the parameters which tell it how you want your service instantiated.
Fast, easy setup. I wish they'd change the name, since I had to cringe when writing up that section of the deployment guide, although I have to say the client has not complained... But name aside, give it a try!
Almost got this working locally. I can pass arguments, only problem is that everything wants to look in system32 directory for all other files.
@bennomatic - I intentionally moved away from nssm during the early days of this project. It has some problems when it comes to logging, so I am extremely unlikely to swap out winsw.exe at this time. Of course, nothing is stopping you from keeping a fork up using nssm!
2-3 years ago I was researching ways to run a node app as a Windows service. Nssm rated lowest on my list which included node-Windows and iis-node.
Regards, Mark Aurit
On Mar 24, 2016, at 4:40 PM, Corey Butler notifications@github.com wrote:
@bennomatic - I intentionally moved away from nssm during the early days of this project. It has some problems when it comes to logging, so I am extremely unlikely to swap out winsw.exe at this time. Of course, nothing is stopping you from keeping a fork up using nssm!
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub
got command line arguments working! Should have PR in today
I was trying to figure out how to pass command-line arguments to the node executable and landed here. If you're in my boat, the solution is to add a "flags" property to the service definition object whose value is a string with space separated arguments. The default value for this "flags" property is "--harmony".
What is the status of this issue? I see that there is an outstanding pull request, but it seems to have stalled.
I just haven't had a chance to go through the merge conflicts in the PR. If someone sorts out the merge conflicts, I'd be happy to merge it.
It looks like the PR was done prior to some major changes, so I'd feel more comfortable if someone more familiar with the code dealt with the conflicts.
I was able to just create another wrapper script that had the parameters I needed and have node-windows call it instead.
the file looked something like this...
var cp = require('child_process');
cp.exec('harp server c:\\mywebpath\\ --port 1234');
It's possible to setup a node script as a service passing specific command line arguments to it?