Through steps found: Is it possible to chain key binding commands in sublime text 2?
Using the following Build System:
{
"cmd": ["g++", "$file", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++, source.cxx, source.cpp",
"variants": [{
"name": "Run",
"shell": true,
"cmd": ["gnome-terminal -e 'bash -c \"${file_path}/${file_base_name};echo;read line;exit; exec bash\"'"]
}]
}
I created the following .py extension:
import sublime, sublime_plugin
class BuildAndRun(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command("build")
self.window.run_command("build", {"variant": "Run"})
And keybiding:
{ "keys": ["ctrl+b"], "command": "build_and_run"},
The keybiding activates the extension correctly, but then in terminal it returns:
bash: /home/hadrian/Documents/new: Permission denied
'new' is the name of of .cpp file.
The problem is also that, if it only has (in the .py extension) build, it builds, if it only has run, it runs, but if it has both it returns that bash error.
I'm not being able to find out where this 'permission error' is created through the whole process.