1

In Visual Studio Code I changed the Default Terminal to Command Prompt. When I want to debug my Azure Function the following command is executed:

Executing task: .venv\Scripts\activate ; func host start <

However, I think it should put the cmd separator "&&" instead of ";". Otherwise the func host start will not execute.

Executing task: .venv\Scripts\activate && func host start <

As far as I know it should auto-detect this. Is there a way to manually change this?

My settings.json:

{
    "terminal.integrated.automationShell.windows": "C:\\windows\\System32\\cmd.exe",
    "terminal.integrated.defaultProfile.windows": "Command Prompt",
    "terminal.integrated.profiles.windows": {
        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [],
            "icon": "terminal-cmd"
        },
        "Git Bash": {
            "source": "Git Bash"
        },
        "C:\\windows\\System32\\cmd.exe": {
            "path": "C:\\windows\\System32\\cmd.exe",
            "args": [],
            "icon": "terminal-cmd"
        },
        "JavaScript Debug Terminal": {
            "extensionIdentifier": "ms-vscode.js-debug",
            "icon": "debug",
            "id": "extension.js-debug.debugTerminal",
            "title": "JavaScript Debug Terminal"
        }
    }
}

Thanks in advance!

#########

SOLUTION:

I was able the change the separator by editing the tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "cmd host start",
            "type": "shell",
            "dependsOn": "pip install (functions)",
            "windows": {
              "command": "${config:azureFunctions.pythonVenv}\\Scripts\\activate && func host start"
            },
            "isBackground": true,
            "problemMatcher": "$func-python-watch",
          },
        {
            "label": "pip install (functions)",
            "type": "shell",
            "osx": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "windows": {
                "command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"
            },
            "linux": {
                "command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"
            },
            "problemMatcher": []
        }
    ]
}

Afterwards in the launch.json, I set the preLaunchTask to "cmd host start".

avaTMO
  • 13
  • 3

1 Answers1

0

Thank you ejizba. Posting your suggestion as an answer to help other community members.

"The debug configuration is specified in your tasks.json and launch.json files in the .vscode folder. The 'windows' 'command' properties default to a PowerShell separator (;), but you're welcome to switch it to a cmd separator (I believe that would just be &&) .

however, because I think we can potentially refactor the tasks.json so that it doesn't use terminal-specific separators and prevent similar issues in the future ."

For more information please refer this SO THREAD

AjayKumarGhose
  • 4,257
  • 2
  • 4
  • 15