-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Args not working in tasks.json using - "_runner":"terminal" #28036
Comments
I tried that on macOS with 1.12.2 and insiders. Works in both cases without issues. |
@gdxn96 which Bash system to you use. The Windows Subsystem for Linux ? |
I can reproduce using Ubuntu bash.exe. The shell args constructed look like this: @Tyriar you once told me that under Windows I must pass one string as a shell arg in case of additional arguments. Is there anything else I need to consider. Must the command passed to echo in this case be quoted ? |
Please note that to easier reproduce I modified the command from .env/bin/python to echo. |
The code works as expected using cmd.exe or powershell. |
Sorry yes, Windows Subsystem for Linux is whats causing the issue |
@dbaeumer so the issue here seems to be related to us not giving bash.exe what it's expecting. Needs some experimentation. |
@Tyriar assigning you as well. If you give me some hints I could look into this as well. |
@dbaeumer I would expect either as args or the single string should work. Not sure what's sent now but maybe for bash.exe on Windows you need a conditional that uses the |
Hi, {
"version": "2.0.0",
"tasks": [
{
"taskName": "Test 1",
"type": "shell",
"command": "uname",
"isShellCommand": true,
"echoCommand": true,
"args": ["-a"],
"showOutput": "always"
}
]
} Expected result: |
@Tyriar I tried both using as single string or a string[]. Both result in the same behavior under Windows of not running the task correctly. What I noticed is that the winpty-agent closed but the electron process started with When passing the args as one string the execution fails with:
Can you please investigate. I ran out of ideas / options. |
For a temporary workaround to this one, please see also: #22663 (comment) |
@Tyriar please see #30417 (comment). It contains a work around by quoting the command line. Is this what I am supposed to do for bash under Windows? |
@dbaeumer According to the bash man page, the argument to
For example, It appears that the command does need to be quoted when passed to |
@dbaeumer & @0not could you please have a look at my previous comment or here? The workaround I implemented works in a similar way but basically I'm collecting all the shell arguments with a powershell script and then calling This not only fixes it but it also allows for other parameters to be appended at the end. For example one extension (solargraph) is defining a command that it needs to run and then appending different arguments depending on the action it wants to perform. Another thing to consider is that the path passed from the task / extension is in the windows format, so my workaround also tries to convert that into a linux path. |
It is correct that the arg passed to -c should be quoted but somehow this is done by the terminal correctly when running bash under Linux and Mac OS but obviously not under Windows. We need to understand what is different in the xterm code and whether quoting it for Windows is the right thing to do. |
I believe I've found a solution, but I don't know how correct it is. In I would create a pull request for this, but embarrassingly, I don't know how and I don't have time tonight. I've tested this solution by building vscode on Windows 10, but I don't know of any unforeseen side effects. |
@dbaeumer On Windows you use the different escaping method ( You could try see if it's |
@dbaeumer all the examples in the issue that introduced the The formatting is done on the |
Fixed by fixing #30417 |
Running this task does not act as expected, it opens the terminal as it should, then it opens a python interpreter, ignoring all my nice args. Have I done something wrong or is it a bug? I've deleted all my other tasks for legibility.
The text was updated successfully, but these errors were encountered: