Skip to content

Typescript build task fails if path to local tsc contains spaces #38408

@luvies

Description

@luvies
  • VSCode Version: 1.18.0 (public)
  • OS Version: macOS 10.13.1 (High Sierra)
  • Reproduces without extensions: Yes

Steps to reproduce:

  1. Have a ${workspaceRoot} in something like /Users/me/dev folder/project/
  2. Install a local version of tsc using npm i typescript --save-dev
  3. Configure the default typescript build task (using the tsc: build - tsconfig.json preset)
  4. It will generate the following:
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "typescript",
            "tsconfig": "tsconfig.json",
            "problemMatcher": [
                "$tsc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
  1. If you run the build task, it will generate the following error:
> Executing task: /Users/me/dev folder/project/node_modules/.bin/tsc -p "/Users/me/dev folder/project/tsconfig.json" <

/bin/bash: /Users/me/dev: No such file or directory
The terminal process terminated with exit code: 127

Terminal will be reused by tasks, press any key to close it.

If I replicate the task manually, using the following

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "'${workspaceRoot}/node_modules/.bin/tsc'",
            "args": [
                "-p",
                "'${workspaceRoot}/tsconfig.json'"
            ],
            "options": {
                "cwd": "${workspaceRoot}"
            },
            "problemMatcher": [
                "$tsc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
}

it works fine, since the executable is wrapped in quotes.

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)tasksTask system issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions