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

forever script's options are parsed as forever options #183

Closed
nherment opened this issue Dec 2, 2011 · 11 comments
Closed

forever script's options are parsed as forever options #183

nherment opened this issue Dec 2, 2011 · 11 comments

Comments

@nherment
Copy link

nherment commented Dec 2, 2011

When running forever start myScript.js -eshost 10.20.12.243, the forever help message is displayed, the script is not started.

It seems that forever interprets the -h from eshost and outputs the help message as if forever -h was run. If instead of -eshost I use -esost, the script is started fine...

I would expect that anything written after myScript.js would be passed as arguments to the script started by forever and not interpreted by forever.

using forever 0.7.2, node 0.4.12, on Mac OSX 10.6.8.
I tried to reproduce with forever 0.7.4 but couldn't get it to work because of issue #179

@mmalecki
Copy link
Contributor

mmalecki commented Dec 2, 2011

Oh, yes, this is optimist's fault (it treats options starting from a single dash as short options and groups them). I'll try to walk it around. Thanks.

@nherment
Copy link
Author

nherment commented Dec 2, 2011

Thanks Maciej !

@indexzero
Copy link
Member

@mmalecki I don't think we should patch optimist for this.

@nherment Is there any reason you can't simply use the --eshost (i.e. double dash instead of single dash?) That will fix your problem.

@nherment
Copy link
Author

nherment commented Dec 2, 2011

I did switch to --eshost. That doesn't fix the actual bug though :)

@indexzero
Copy link
Member

Weird

@mmalecki
Copy link
Contributor

mmalecki commented Dec 2, 2011

@indexzero No no, it's because of way we parse options there. We should pop script options from process.argv before we check for help. It's unclean, tho.

@nherment
Copy link
Author

nherment commented Dec 2, 2011

Well, @indexzero 's workaround works.

What I mean is that some people would want to use some combination of options that conflict with those that forever uses.

@mmalecki
Copy link
Contributor

mmalecki commented Dec 2, 2011

@nherment No, this is caused by https://github.com/nodejitsu/forever/blob/master/lib/forever/cli.js#L465. No other conflict is possible.
@indexzero What about respecting --help in flatiron?

@indexzero
Copy link
Member

Yeah. +1 for dropping that line in forever. It is respected in flatiron now, but it could probably be better: https://github.com/flatiron/flatiron/blob/master/lib/flatiron/plugins/cli.js#L136-137

@isakb
Copy link

isakb commented Apr 22, 2013

How about allowing me to quote the script including the options passed to the script?

Forever is working fine for me on version 0.10.0, but with version 0.10.6 it's passing my arguments to forever instead of to my script. The reason seems to be that optimist was updated from version 0.3.4 to 0.4.0.

Here is an example of how I call forever:

forever --minUptime 5000 \
    --spinSleepTime 20000 \
    /path/to/proxy-server.js --verbose http://proxy-target-server/

The flag --verbose and http://proxy-target-server/ is intended for proxy-server.js, not for forever.

This will not work either:

forever --minUptime 5000 \
    --spinSleepTime 20000 \
   "/path/to/proxy-server.js --verbose http://proxy-target-server/"

@potomak
Copy link

potomak commented Jul 24, 2013

I have the same issue.

I think you should reopen this issue or change help:

usage: forever [action] [options] SCRIPT [script-options]

[script-options] are ignored.

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

No branches or pull requests

5 participants