Git Product home page Git Product logo

Comments (7)

Hubro avatar Hubro commented on May 18, 2024

I forked the project to try to fix this myself, but it doesn't seem to be possible to pass ordered arguments to child_process.spawn

from nodemon.

loganfsmyth avatar loganfsmyth commented on May 18, 2024

I don't think the spawn function is the issue.

I think the only issue is that the arguments are sliced, but then they are shifted and unshifted onto different arrays. Any arguments in 'nodemonargs' that get unshifted into 'appargs' will have their order reversed.

See arg parsing here: https://github.com/remy/nodemon/blob/master/nodemon.js#L229

from nodemon.

Hubro avatar Hubro commented on May 18, 2024

Well that's just silly of me, forgetting the arrays have a set order. I've fixed the problem and have issued a pull request

from nodemon.

remy avatar remy commented on May 18, 2024

nodemon has this support baked in, so run this:

nodemon --debug server.coffee

The extra params get added on automatically.

On 15 Jan 2012, at 02:49, Tomas Sandven [email protected] wrote:

I'm trying to pass the arguments --nodejs --debug to coffee-script through nodemon. This is what I write:

nodemon --nodejs --debug -w src -x coffee src/server.coffee

It should work, but unfortunately nodemon is passing the arguments to coffee in the wrong order, giving me this error:

$ nodemon --nodejs --debug -w src -x coffee src/server.coffee
15 Jan 03:47:10 - [nodemon] v0.6.5
15 Jan 03:47:10 - [nodemon] watching: /root/projects/honstreams/server/src
15 Jan 03:47:10 - [nodemon] running --debug
15 Jan 03:47:10 - [nodemon] starting `coffee --debug --nodejs src/server.coffee`

node.js:201
       throw e; // process.nextTick error, or 'error' event on first tick

^

Error: unrecognized option: --debug
...

Coffee-script doesn't recognize the option --debug. The option --nodejs should come first, so coffee script knows to send the following arguments to node.


Reply to this email directly or view it on GitHub:
#54

from nodemon.

Hubro avatar Hubro commented on May 18, 2024

I saw that in the source and tried it, but it doesn't work.

$ nodemon --debug src/server.coffee
15 Jan 10:16:40 - [nodemon] v0.6.5
15 Jan 10:16:40 - [nodemon] watching: /root/foo/bar/server
15 Jan 10:16:40 - [nodemon] running --debug
15 Jan 10:16:40 - [nodemon] starting `node --debug src/server.coffee`
debugger listening on port 5858

/root/foo/bar/server/src/server.coffee:2

# Dependencies

^

node.js:201

        throw e; // process.nextTick error, or 'error' event on first tick
^

SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:427:25)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)

15 Jan 10:16:40 - [nodemon] app crashed - waiting for file changes before starting...
^C15 Jan 10:16:42 - [nodemon] exiting

So it's not using the coffee executable. Specifying the executable works no better

$ nodemon --debug -x coffee src/server.coffee
15 Jan 10:20:08 - [nodemon] v0.6.5
15 Jan 10:20:08 - [nodemon] watching: /root/foo/bar/server
15 Jan 10:20:08 - [nodemon] running --debug
15 Jan 10:20:08 - [nodemon] starting `coffee --debug src/server.coffee`

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: unrecognized option: --debug
    at OptionParser.parse (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/optparse.js:40:17)
    at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:404:29
    at Object.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:46:5)
    at Object. (/usr/local/lib/node_modules/coffee-script/bin/coffee:7:41)
    at Module._compile (module.js:432:26)
    at Object..js (module.js:450:10)
    at Module.load (module.js:351:31)
    at Function._load (module.js:310:12)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)

15 Jan 10:20:08 - [nodemon] app crashed - waiting for file changes before starting...
^C15 Jan 10:20:09 - [nodemon] exiting

No extra stuff being inserted here to help coffee-script debug.

from nodemon.

loganfsmyth avatar loganfsmyth commented on May 18, 2024

@remy The automatic --nodejs logic is there, but it's not quite working.

Here: https://github.com/remy/nodemon/blob/master/nodemon.js#L277

program.app is already set in getNodemonArgs, why does it need to be set again? This line break it because args in this case contains --debug first, so program.app ends up as --debug and the extension logic doesn't kick in.

Either way though, it is still a good idea to preserve argument ordering. What if someone had a custom exec that had space separated args like nodemon's -w args? They'd have to pass them in backwards.

Pull request is over here: #55

from nodemon.

remy avatar remy commented on May 18, 2024

I've got a fix working - both to support:

nodemon --debug app.coffee

And

nodemon -x coffee --nodejs --debug app.coffee

I'm just running through some tests to make sure the change is good.

from nodemon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.