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

Unable to pass command line parameters after the double dash in Windows Terminal #18232

Closed
hh54188 opened this issue Nov 21, 2024 · 3 comments
Closed
Labels
Issue-Question For questions or discussion Needs-Tag-Fix Doesn't match tag requirements Resolution-Answered Related to questions that have been answered

Comments

@hh54188
Copy link

hh54188 commented Nov 21, 2024

Windows Terminal version

1.21.2911.0

Windows build number

10.0.19045.2604

Other Software

Node: v20.16.0
NPM: 10.8.1

Steps to reproduce

Here is the command I want to run on Windows Terminal:

pm2 start C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app -- --port 3000

If I run it in the Windows Terminal, I will get this error:

error: unknown option `--port'.

The same error will appear in the Powershell. But it will succeed in the Command Line.

Is there a way to solve this problem?

Expected Behavior

The port number parameter can be passed to the command line successfully.

Actual Behavior

error: unknown option `--port'.

@hh54188 hh54188 added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 21, 2024
@DHowett
Copy link
Member

DHowett commented Nov 21, 2024

When you say “in Windows Terminal,” is there a chance you mean “in PowerShell”?

Terminal supports running different shells, like PowerShell and Command Prompt.

If you are seeing a difference in argument handling, there is a chance you are not using the shell you are expecting.

EDIT: ah, I see you included that info in your original issue.

@DHowett
Copy link
Member

DHowett commented Nov 21, 2024

Is there a way to solve this problem?

You can run Command Prompt inside Windows Terminal. Please consult the dropdown menu for either a one-off option to run Command Prompt or a permanent option to configure your “Default Profile”.

@elsaco
Copy link

elsaco commented Nov 21, 2024

@hh54188 in pwsh try using quotes or escape the double hyphen.

Sample output:

PS C:\Users\WDAGUtilityAccount> pm2 start C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app '--' --port 3000
[PM2][ERROR] Script not found: C:\Users\User\AppData\Roaming\npm\node_modules\http-server\bin\http-server
PS C:\Users\WDAGUtilityAccount> pm2 start .\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-ser
ver-app -- --port 3000

  error: unknown option `--port'

PS C:\Users\WDAGUtilityAccount> pm2 start .\AppData\Roaming\npm\node_modules\http-server\bin\http-server --name http-server-app `-- --port 3000
[PM2] Starting C:\Users\WDAGUtilityAccount\AppData\Roaming\npm\node_modules\http-server\bin\http-server in fork_mode (1 instance)
[PM2] Done.
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ http-server-app    │ fork     │ 0    │ online    │ 0%       │ 45.6mb   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘

@DHowett DHowett added Issue-Question For questions or discussion Resolution-Answered Related to questions that have been answered and removed Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 21, 2024
@DHowett DHowett closed this as not planned Won't fix, can't repro, duplicate, stale Nov 21, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question For questions or discussion Needs-Tag-Fix Doesn't match tag requirements Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

3 participants