Sublime Forum

[Bugreport][Solved] show_panel_on_build freezes the build

#1

Hello,

I think I found a bug.

I was editing the Make.sublime-build so that It would execute the build in a new terminal.

It worked if I didn’t use the "show_panel_on_build":false

If I did include it the build would freeze and I would get an empty build panel.
The reason appears to be because sublime would parse the parameter to the shell and the shell would complain about this unknown parameter.

The crash was in ~/.conf/sublime-text-2/Packages/Default/exec.py:133

The original code looked like this:

            show_panel_on_build = sublime.load_settings("Preferences.sublime-settings").get("show_panel_on_build", True)

        if show_panel_on_build:
            self.window.run_command("show_panel", {"panel": "output.exec"})

This is my fix.

  1. check if the ‘show_panel_on_build’ is in the kwargs
  2. If it is, use it’s setting and remove it from the kwargs
  3. If it isn’t in the kwargs, procede as you normally would.
        if(kwargs.has_key('show_panel_on_build')):
            show_panel_on_build = kwargs.get('show_panel_on_build',True)
            kwargs.pop('show_panel_on_build')
        else:
            show_panel_on_build = sublime.load_settings("Preferences.sublime-settings").get("show_panel_on_build", True)

        if show_panel_on_build:
            self.window.run_command("show_panel", {"panel": "output.exec"})

Here is the Make.sublime-build settings.

{
  "shell":true,
  "show_panel_on_build": false,
  "cmd": "gnome-terminal -e '/home/user/.config/sublime-text-2/runscript.sh'"],
  "file_regex": "^(..^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
  "working_dir": "${project_path:${folder:${file_path}}}",
  "selector": "source.makefile",
  "variants":
  
    {
      "name": "Clean",
      "cmd": "make", "clean"]
    }
  ]
}

Here is the runscript.sh. All it does is make the file, execute it and then wait for the user to close the terminal by pressing enter.

#!/bin/bash

make
./a.out

echo "Press return to continue"
v=""
read v
0 Likes