Skip to content

Debug task runner: check for powershell.exe _and_ pwsh.exe to determine if "&&" can be used to chain commands #2329

Closed

Description

Environment data

  • VS Code version: 1.25.1
  • Extension version (available under the Extensions sidebar): 2018.7.1
  • OS and version: Windows 10 1803, x64
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.5 x64
  • Type of virtual environment used: N/A
  • Relevant/affected Python packages and their versions: N/A

Actual behavior

Launching debug task uses "&&" to chain commands when shell set to "pwsh.exe".

Expected behavior

Powershell only likes ";" to chain commands.

Steps to reproduce:

  1. In some Python project, configure this task:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Test script",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/test.py",
        },
    ]
}
  1. Install Powershell 6.0.x
  2. Set "terminal.integrated.shell.windows": "pwsh.exe" in configuration (PowerShell 6.0.x uses it to differentiate itself from the Windows Powershell)
  3. "Start Debugging" with that task
  4. Set shell to "powershell.exe" and repeat.

Logs

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

> cd c:\[...]\fontParts && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && python c:\[...]\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_launcher.py c:\[...]\fontParts
61019 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput C:\[...]\fontParts/Lib/fontParts/fontShell/test.py "
At line:1 char:59
+ cd c:\[...]\fontParts && cmd /C " ...
+                                                           ~~
The token '&&' is not a valid statement separator in this version.
+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidEndOfLine

Activity

  1. d3r3kk commented on Aug 3, 2018

    @d3r3kk

    Preamble to verification: IIRC all versions of Powershell handle the use of ; to chain commands, so we'd simply need to know if we are running under a Powershell command shell of any sort, and update the 'chain character' accordingly.

  2. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    feature-requestRequest for new features or functionality
    on Aug 3, 2018
  3. DonJayamanne commented on Aug 5, 2018

    @DonJayamanne

    Brett Cannon (@brettcannon) Derek Keeler (@d3r3kk)
    Please report this issue upstream, on vscode.
    All we do is pass the information to vscode via the debugger API.

  4. brettcannon commented on Aug 9, 2018

    @brettcannon
    Member

    Looks like Nikolaus Waxweiler (@madig) beat us to it. 😄 Thanks for filing the issue for us!

  5. brettcannon commented on Aug 16, 2018

    @brettcannon
    Member

    I'll quickly mention that under PowerShell Core 6.0.3 I got ; used as my separator:

    cd 'c:\Users\...\Desktop\testing\some 3.7 bunk'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; ...
    
  6. DonJayamanne commented on Sep 12, 2018

    @DonJayamanne

    I think we can close this issue, as its an upstream VS Code issue. Also the issue has been fixed in VSC.

  7. locked as resolved and limited conversation to collaborators on Oct 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions