Sublime Forum

Build system with terminus doesn't work

#1

How can I pass this command
"cmd": "g++ -std=c++17 -Wall \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
to terminus.
I am trying to create a c++ build system but it doesn’t seem to work.

{
"target": "terminus_open",
"auto_close": false,
// "title": "Cpp Output",
// "tag": "cpp",
"cmd": "g++ -std=c++17 -Wall \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
//"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"shell":true,
"working_dir":"$file_path",
"selector":"source.c++, source.cpp, source.cc, source.cxx",

}

0 Likes

#2

You have two issues here:

  1. You’re using "shell": true in the build, but Terminus doesn’t support that argument; if you look in the console when you execute the build, there’s an error message to that effect:

Traceback (most recent call last):
File “/home/tmartin/.config/sublime-text/Installed Packages/Terminus.sublime-package/terminus/core.py”, line 98, in
TypeError: run_async() got an unexpected keyword argument ‘shell’

  1. The value of cmd needs to be a list of strings, but you’re passing it as a single string. Based on what you’re trying to do here, you want to alter cmd to be shell_cmd instead.

Try a build that looks something like this:

{
    "target": "terminus_open",
    "auto_close": false,
    // "title": "Cpp Output",
    // "tag": "cpp",
    "shell_cmd": "g++ -std=c++17 -Wall \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
    //"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir":"$file_path",
    "selector":"source.c++, source.cpp, source.cc, source.cxx",
}

This video talks about how to convert a build system to be a Terminus build and also includes a segment at the end that discusses the distinction between shell_cmd and cmd and how shell is not supported; the link here should jump directly to that part of the video if you’d like more explanation on what’s going on.

2 Likes

[Windows] Bizarre Issue with Compiling C++
#3

Thanks a lot!! It worked.
Damn. The work on your youtube channel is amazing. Helped me a lot in understanding and make sublime text more interactive for my projects.
Subscribed the channel and loved your work.

1 Like