Sublime Forum

Build variant does not work

#1

I have defined a very simple build variant, that should just echo to the console.

But when I call it , the sublime console just opens, stays empty, and hangs…

I am rather confused. I am running on Linux mint 19.1.

{
“cmd”: ["./build.sh"],
“working_dir”: “${project_path}”,
“file_regex”: “^(/…?):([0-9]):?([0-9]*)”,

"variants": [
    {
        "name": "install",
        "cmd": ["echo" , "SOMETEXTGTTTTT"]
    }
]

}

0 Likes

#2

echo is a shell command, so you need to be invoking it inside a shell. Fortunately, build systems provide this option through the shell_cmd key, which accepts a string to be run by the shell. Thus, your build system should look as follows:

{
    "cmd": ["./build.sh"],
    "working_dir": "${project_path}",
    "file_regex": "^(/...?):([0-9]*):?([0-9]*)",

    "variants": [
        {
            "name": "install",
            "shell_cmd": "echo SOMETEXTGTTTTT"
        }
    ]
}

Note: there are some * missing in your file_regex because you didn’t post it as a code segment.

1 Like

#3

Hi! Thanks for the reply!

When I changed it to a shell_cmd, the Sublime console window does not even open…

0 Likes

#4

The two things to check out in that case are:

  1. Does the console (View > Show Console) display any error messages?
    An error you might see in this case is Can't convert 'list' object to str implicitly, which would be an indication that you changed cmd to shell_cmd but forgot to remove the [] around the value for the key.

  2. Do you see the status line say No Build System when you run the build?
    Assuming you know for sure that the build is being properly selected (I assume this is the case), this error message is an indication that something about the JSON in the sublime-build file is invalid, such as missing

If neither of those is the case, any error message you see in the console will help to diagnose things further.

0 Likes

#5

Your initial response was the correct answer to fix my problem.

The problem was that I didn’t pay attention to the changed formatting of the command and its arguments into a single string literal.

Thanks.

0 Likes