1

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.

Community
  • 1
  • 1
  • even with the plugin 'Chain of Command' i get the same bash error –  May 28 '14 at 21:05
  • Try: replace `["gnome-terminal -e 'bash -c \"${file_path}/${file_base_name};echo;read line;exit; exec bash\"'"]` with `["gnome-terminal -e 'bash -c \"bash ${file_path}/${file_base_name};echo;read line;exit; exec bash\"'"]` or `["gnome-terminal -e 'bash -c \"exec ${file_path}/${file_base_name};echo;read line;exit; exec bash\"'"]` – totti Jun 30 '14 at 07:59
  • 1
    I would **strace** sublime process to have more details about the 'permission denied'. – R.Sicart Jul 06 '14 at 10:20

0 Answers0