randy3k / Terminus

Bring a real terminal to Sublime Text
https://packagecontrol.io/packages/Terminus
MIT License
1.39k stars 81 forks source link

Terminus - Not Working properly with cmd #192

Open yurijserrano opened 4 years ago

yurijserrano commented 4 years ago

Good Morning

I've been testing Terminus and with builds presented some problems one of them it's just that is not working properly with the cmd property.

The code below works smoothly without trying to execute with Terminus:

{
    "shell":true,
    "selector" : "*.kt",
    "file_regex": "^(.*):([0-9]+):([0-9]+): (?:error|warning):(.*)",
    "cmd" : "kotlinc $file -include-runtime -d ${file_base_name}.jar", 
    "working_dir": "${file_path}",
    "variants": [{
        "name": "Compile",
        "cmd": "kotlinc $file -include-runtime -d ${file_base_name}.jar"
      },{
        "name": "Compile + Run",
        "cmd": "kotlinc \"${file}\" -include-runtime -d ${file_base_name}.jar || exit 1; java -jar ${file_base_name}.jar",
      },{
        "cmd": "java -jar ${file_base_name}.jar",
        "name": "Run"
    }]
}

This is a build for the kotlin language and works well with the shell set to true, but trying to use terminus just pop up this message:

FileNotFoundError: The command was not found or was not executable: kotlinc "/home/yuri/Desktop/HI/HelloWorld.kt" -include-runtime -d HelloWorld.jar || exit 1; java -jar HelloWorld.jar.

It's not identifying the compiler kotlinc for solve this I've separated the commands using the [] annotation, but when it comes with multiple commands that involves && as below end up not working:

"cmd": ["kotlinc","$file_name","-include-runtime","-d","${file_base_name}.jar","&&", "java","-jar", "${file_base_name}.jar"]

For solve all these problems I've used the shell_cmd, but to help improve Terminus that is a good plugin, the command cmd it's not working with string just with array and multiple commands even with the array annotation it's not working if we compare using the shell that both ways are working fine.

I hope this helps Terminus to improve even more.

OBS: All the tests were made with the last version of the Terminus

randy3k commented 4 years ago

I am a bit lost. To put it short, you should really be using shell_cmd if you want to run a shell command. cmd should be only used if you want to call a specific program with arguments.

You are somehow mixing the usage of cmd and shell_cmd.

yurijserrano commented 4 years ago

Good Morning @randy3k

Thanks for the answer

I know the difference between cmd and shell_cmd, what I tried to say was that the first snippet that I included run smoothly even with multiple commands with "shell":true.

As we can't use the shell property together with terminus because we got this:

sublime-text-3/Installed Packages/Terminus.sublime-package/terminus/core.py", line 97, in <lambda>
TypeError: run_async() got an unexpected keyword argument 'shell'

I know that we can achieve this including bash or sh with the -c option inside the cmd property, but I thought that because it was running on Terminus (terminal / bash) this would be achieved, but it was not.

So my intention in reporting this is that in a future update, terminus can support this, as is achieved when shell: true

Once more, thanks for your attention