Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command line arguments #100

Open
tallesl opened this issue Aug 6, 2015 · 16 comments · May be fixed by #119
Open

command line arguments #100

tallesl opened this issue Aug 6, 2015 · 16 comments · May be fixed by #119

Comments

@tallesl
Copy link

tallesl commented Aug 6, 2015

It's possible to setup a node script as a service passing specific command line arguments to it?

@scaret
Copy link

scaret commented Oct 27, 2015

+1

1 similar comment
@vicneanschi
Copy link

+1

@bladerunner2020
Copy link

I miss this feature as well.

@bennomatic
Copy link

+1

I'd love this as a feature!

@NogsMPLS
Copy link

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?

@coreybutler
Copy link
Owner

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.

@bennomatic
Copy link

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!

@NogsMPLS
Copy link

Almost got this working locally. I can pass arguments, only problem is that everything wants to look in system32 directory for all other files.

@coreybutler
Copy link
Owner

@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!

@MarkAurit
Copy link

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 [email protected] 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

@NogsMPLS
Copy link

got command line arguments working! Should have PR in today

@NogsMPLS NogsMPLS linked a pull request Mar 25, 2016 that will close this issue
@carnesen
Copy link

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".

@scpeterson
Copy link

What is the status of this issue? I see that there is an outstanding pull request, but it seems to have stalled.

@coreybutler
Copy link
Owner

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.

@scpeterson
Copy link

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.

@StingyJack
Copy link

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');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.