augustocdias / vscode-shell-command

A task helper to use system commands as input
MIT License
51 stars 19 forks source link

Command cannot be an array #83

Closed AJIOB closed 7 months ago

AJIOB commented 7 months ago

Current problem

Error message from VSCode:

Could not find input with command '${config:cmake.cmakePath} -E cat test-environment.txt' and taskId 'load-path-value-task'.

Bad command from launch.json:

        {
            "id": "load-path-value",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "useSingleResult": true,
                "description": "Load PATH value",
                "command": [
                    "${config:cmake.cmakePath}",
                    "-E",
                    "cat",
                    "test-environment.txt"
                ],
                "taskId": "load-path-value-task",
                "cwd": "${command:cmake.buildDirectory}",
                "defaultOptions": [
                    "<Please, reconfigure CMake>",
                ],
            }
        }

Good command from launch.json:

        {
            "id": "load-path-value",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "useSingleResult": true,
                "description": "Load PATH/LD_LIBRARY_PATH value",
                "command": "${config:cmake.cmakePath} -E cat test-environment.txt",
                "taskId": "load-path-value",
                "cwd": "${command:cmake.buildDirectory}",
                "defaultOptions": [
                    "<Please, reconfigure CMake>",
                ],
            }
        }

The difference is in command. As I can see, command may be an array of strings too. Why the variables are not resolved in this way?

Environment:

Original problem

The main problem for migrating to the array is a spacing support. If the user have a spaces, as Windows likes, we have an error with the "good" variant: image

That's why I need to manually define every argument for the command line building.

MarcelRobitaille commented 7 months ago

Sorry. This was broken in #74. Should be fixed in v1.9.2.

AJIOB commented 7 months ago

Hi @MarcelRobitaille

Thanks for your fix. The variables applying is works for now.

After the upgrading to the 1.9.2 I still have the original problem & create an issue #85 for it.