0

Can anyone spot the reason why the following Task doesn't run from Visual Studio Code 1.18 on Ubuntu?

I've tried quite a few things and think it's a bug in the way Code closes processes on Ubuntu. The isBackground property does not change the behavior. Chaining a sleep 10 to the command keeps the browser open until the sleep returns. I expected the task to behave as if you ran xdg-open index.html; exit from the shell.

// tasks.json
{
    "version": "2.0.0",
    "tasks": [
         {
            "label": "Open Coverage in default browser",
            "type": "shell",
            "linux": {
                "command": "xdg-open '${workspaceFolder}/coverage/index.html'"
            },
            "windows": {
                "command": "explorer \"${workspaceFolder}\\coverage\\index.html\""
            },
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared"
            },
           "problemMatcher": []
        }
    ]
}
Sean
  • 1,279
  • 9
  • 17

1 Answers1

1

Presumably, Visual Studio Code simply kills all processes in the same process group when xdg-open finishes. Using setsid xdg-open <file> you effectively put the process into a session of its own and prevent Code from terminating it.