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

command line to launch task is badly formed for integrated terminal #21635

Closed
jamietre opened this issue Mar 1, 2017 · 8 comments
Closed

command line to launch task is badly formed for integrated terminal #21635

jamietre opened this issue Mar 1, 2017 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@jamietre
Copy link

jamietre commented Mar 1, 2017

  • VSCode Version: 1.10.0-insider
  • OS Version: Windows 10

Steps to Reproduce:

  1. Create a launch config using "integratedTerminal"
  2. Run it

My configuration creates the following command line, which isn't valid (pehaps there should be an && there instead of the semicolon?)

cd d:\Users\JAMIE\code\project; env NODE_ENV=mocha node --debug-brk=45564 --nolazy node_modules\mocha \bin\_mocha --watch --debug test/unit/**/*.ts

This is the config

        {
            "name": "Launch Unit Tests",
            "type": "node",
            "request": "launch",
            "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
            "stopOnEntry": false,
            "args": [
                "--watch",
                "--debug",
                "test/unit/**/*.ts"
            ],
            "runtimeExecutable": null,
            "env": {
                "NODE_ENV": "mocha"
            },
            "sourceMaps": true,
            "console":"integratedTerminal",
            "outFiles": [
                "dist"
            ],
            "skipFiles": [
                "node_modules/**/*.js",
                "<node_internals>/**/*.js"
            ]
        }
@Tyriar Tyriar assigned dbaeumer and unassigned Tyriar Mar 1, 2017
@Tyriar Tyriar added the tasks Task system issues label Mar 1, 2017
@dbaeumer dbaeumer added debug Debug viewlet, configurations, breakpoints, adapter issues and removed tasks Task system issues labels Mar 2, 2017
@dbaeumer dbaeumer assigned isidorn and unassigned dbaeumer Mar 2, 2017
@dbaeumer
Copy link
Member

dbaeumer commented Mar 2, 2017

@isidorn I assign back to you. It is a launch config without a pre task. Not sure so if this is debug or the integrated terminal.

@isidorn
Copy link
Contributor

isidorn commented Mar 2, 2017

As far as I understand, this is the integrated terminal can not handle some output the users program is computing. If I am mistaken then please provide more details @jamietre
Unrelated to debug. Assigning back to @Tyriar

@isidorn isidorn removed the debug Debug viewlet, configurations, breakpoints, adapter issues label Mar 2, 2017
@isidorn isidorn assigned Tyriar and unassigned isidorn Mar 2, 2017
@jamietre
Copy link
Author

jamietre commented Mar 2, 2017

This is not realated to "debug" in particular, this just happened to be a debug task. It is related to launching tasks configured using "launch.json" with the "integratedTerminal" option.

This is the command generated by VS Code when I start my task called "Launch Unit Tests". It's not any code of mine or a user program. I assume it is produced entirely from the launch.json config I included above.

If I try to start this task using integratedTerminal, it fails, and it shows this command line in my integrated console:

cd d:\Users\JAMIE\code\project ; env NODE_ENV=mocha node --debug-brk=45564 --nolazy node_modules\mocha \bin\_mocha --watch --debug test/unit/**/*.ts

If I start it using internalConsole then it works, and it only show this command line:

node --debug-brk=43169 --nolazy node_modules\mocha\bin\_mocha --watch --debug test/unit/**/*.ts

So using the integratedTerminal option seems to generate an extra cd command (even though the terminal already seems to open in the working directory) and separates it from the debug launch command with a semicolon.

@Tyriar
Copy link
Member

Tyriar commented Mar 3, 2017

@isidorn @weinand I think it's related to debug launching the user configured shell, not a specific one so the command appending being used is not reliable. You can also set the cwd in IShellLaunchConfig when creating an ITerminalInstance now which is the best fix for this.

@Tyriar Tyriar assigned weinand and isidorn and unassigned Tyriar Mar 3, 2017
@Tyriar Tyriar added the debug Debug viewlet, configurations, breakpoints, adapter issues label Mar 3, 2017
@isidorn
Copy link
Contributor

isidorn commented Mar 3, 2017

Assigning to @weinand since TerminalSupport is handling this I believe

@isidorn isidorn removed their assignment Mar 3, 2017
@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Mar 3, 2017
@jamietre
Copy link
Author

jamietre commented Mar 16, 2017

I haven't tried this in a few days, but In today's preview, using "intergratedTerminal" or "externalTerminal", it's broken in a different way:

image

Seems like it's not quoting the CLI exe path itself properly now...

"terminal.integrated.shell.windows": "c:\\program files\\JPSoft\\TCCLE14x64\\tcc.exe",

Opening a terminal window works fine still, but launching a task with it doesn't at all any more. "internalConsole" is the only one working.

Using old trick C:\\progra~1\\... works as far as actually opening the console... but the command is still badly formed as my original bug report.

@weinand
Copy link
Contributor

weinand commented Aug 28, 2017

Verification notes:

The fix addresses issues that occurred when configuring:

  • the console attribute in a launch config to integratedTerminal and
  • the shell for the integrated terminal via the terminal.integrated.shell.* settings.

The fixed issues:

  • if the configured shell is not recognised by VS Code, we no longer fall back to always assume a unix shell but use the platform default. On Windows: cmd.exe on linux & macOS: bash.
  • if a bash shell is configured on Windows (e.g. git bash.exe or WSL bash.exe), it is properly recognised as such and paths containing backslashes are put in quotes so that the backslashes survive.
  • if the shell is configured to be PowerShell, and the runtimeExecutable of a launch config contains a space, the argument is quoted and must be prepended by an ampersand ('&') when passed to PowerShell.

@aeschli
Copy link
Contributor

aeschli commented Aug 31, 2017

Verified the first item

@aeschli aeschli added verified Verification succeeded and removed verification-needed Verification of issue is requested labels Sep 1, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
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 debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants