question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DonJayamannecommented, Sep 12, 2018

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

0reactions
brettcannoncommented, Aug 16, 2018

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'; ...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug task runner: check for powershell.exe _and_ pwsh.exe ...
Debug task runner : check for powershell.exe _and_ pwsh.exe to determine if "&&" can be used to chain commands #55852 ; bug Issue...
Read more >
about Pwsh - PowerShell | Microsoft Learn
Explains how to use the `pwsh` command-line interface. Displays the command-line parameters and describes the syntax.
Read more >
PowerShell@2 - PowerShell v2 task | Microsoft Learn
Use this task to run a PowerShell script on Linux, macOS, or Windows. ... If the value is set to true , the...
Read more >
Start-Process (Microsoft.PowerShell.Management)
This example starts a process that uses the Sort.exe file in the current folder. The command uses all the default values, including the...
Read more >
Get-Process (Microsoft.PowerShell.Management)
This command gets all processes that have a working set greater than 20 MB. It uses the Get-Process cmdlet to get all running...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found