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

Arguments Incorrectly Parsed #228

Open
cawoodm opened this issue Jan 24, 2023 · 3 comments
Open

Arguments Incorrectly Parsed #228

cawoodm opened this issue Jan 24, 2023 · 3 comments

Comments

@cawoodm
Copy link

cawoodm commented Jan 24, 2023

If I run supervisor script.js arg1 I expect it to run node script.js arg1 however it seems to be running node arg1.

$supervisor -- .\tests\script.js arg1

Running node-supervisor with
  program 'arg1'
  --watch '.'
  --extensions 'node,js'
  --exec 'node'

Starting child process with 'node arg1'
Watching directory 'C:\projects\order' for changes.
Press rs for restarting the process.
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'C:\projects\order\arg1'
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.12.1
Program node arg1 exited with code 1

Version: latest: 0.12.0

Possibly related to #191

@cawoodm
Copy link
Author

cawoodm commented Jan 24, 2023

Just to add - I am running this from Powershell v7 on Windows 10.

If I run it from the command prompt cmd.exe it works fine.

@cawoodm
Copy link
Author

cawoodm commented Jan 24, 2023

Correction - it works under cmd.exe UNLESS we pass arguments to supervisor

Working

$supervisor -- .\tests\script.js arg1

Running node-supervisor with
  program '.\tests\script.js arg1'
  --watch '.'
  --extensions 'node,js'
  --exec 'node'

Starting child process with 'node .\tests\script.js arg1'
Watching directory 'C:\projects\order' for changes.
Press rs for restarting the process.

Not Working

$supervisor -w tests -n -- .\tests\script.js arg1

Running node-supervisor with
  program 'arg1'
  --watch 'tests'
  --extensions 'node,js'
  --exec 'node'

Starting child process with 'node arg1'
Watching directory 'C:\projects\order\tests' for changes.
Press rs for restarting the process.
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'C:\projects\order\arg1'

@cawoodm
Copy link
Author

cawoodm commented Jan 24, 2023

Weirdly, adding -V (or even -v) causes it to work - though it would appear -v (or whatever) is ignored:

C:\projects\order>supervisor -w tests -n -V -- .\tests\script.js arg1

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

1 participant