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

Task arguments ignored when quotes inside argument #59334

Closed
sguillia opened this issue Sep 25, 2018 · 5 comments · Fixed by #59642
Closed

Task arguments ignored when quotes inside argument #59334

sguillia opened this issue Sep 25, 2018 · 5 comments · Fixed by #59642
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release tasks Task system issues terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded

Comments

@sguillia
Copy link

Issue Type: Bug

The arguments of my task command are merely ignored whenever there are quotes inside them.

Steps to reproduce

  1. Create an executable script that shows the number of arguments that are passed to it.
    I called it show_args.sh
#!/bin/bash
echo Nb args: $#
echo $@
  1. Define some task in tasks.json
        {
            "label": "VS Code bug repro",
            "type": "shell",
            "command": [
                "/d/show_args.sh hello \"world\""
            ],
            "problemMatcher": []
        }
  1. Run the task

  2. See the output

> Executing task: /d/show_args.sh hello "world" <

Nb args: 0

Even the hello argument is ignored.

Remove the quotes around world and the script will work:

> Executing task: /d/show_args.sh hello world <

Nb args: 2
hello world

This bug makes the task feature unusable when quotes are required

VS Code version: Code - Insiders 1.28.0-insider (fe8d9d2, 2018-09-25T05:31:33.193Z)
OS version: Windows_NT x64 10.0.15063

@vscodebot vscodebot bot added the insiders label Sep 25, 2018
@dbaeumer dbaeumer added info-needed Issue requires more information from poster tasks Task system issues and removed insiders labels Sep 26, 2018
@dbaeumer
Copy link
Member

@sguillia which shell (bash) are you using? WSL?

@sguillia
Copy link
Author

@dbaeumer if the default task shell is the same as the default integrated terminal shell, then I am using Git Bash.

I have this in settings.json:

"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"

@dbaeumer
Copy link
Member

I am able to reproduce this using the following setup:

tasks.json

{
	"version": "2.0.0",
	"tasks": [
    	{
			"label": "VS Code bug repro",
			"type": "shell",
			"options": {
				"shell": {
					"executable": "C:\\Program Files\\Git\\bin\\bash.exe",
					"args": [
						"-c"
					]
				}
			},
			"command": [
				"./show_args.sh hello \"world\""
			],
			"problemMatcher": []
		}
	]
}

./show_args.sh

#!/bin/bash
echo Nb args: $#
echo $@

Using ' around world works as expected.

@Tyriar here is the shell launch config I use to start the terminal:

capture

Any advice you can give to make this work for " as quotes. In general the data looks good to me.

@dbaeumer dbaeumer added bug Issue identified by VS Code Team member as probable bug terminal Integrated terminal issues and removed info-needed Issue requires more information from poster labels Sep 27, 2018
@dbaeumer dbaeumer added this to the On Deck milestone Sep 27, 2018
@Tyriar
Copy link
Member

Tyriar commented Sep 28, 2018

@alexr00 recently made a change in this area and might have an idea what's going on with this case.

@Tyriar Tyriar modified the milestones: On Deck, September 2018 Sep 28, 2018
@Tyriar
Copy link
Member

Tyriar commented Sep 28, 2018

Possible candidate, marking with September.

alexr00 added a commit to microsoft/node-pty that referenced this issue Sep 28, 2018
@alexr00 alexr00 added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Sep 28, 2018
@Tyriar Tyriar added the candidate Issue identified as probable candidate for fixing in the next release label Sep 28, 2018
Tyriar added a commit that referenced this issue Sep 28, 2018
@mjbvz mjbvz added the verified Verification succeeded label Oct 4, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release tasks Task system issues terminal Integrated terminal issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants