Sublime Forum

Start async build from plugin

#1

I’m working on a plugin where builds were executed synchronously using ‘runcmd’, which is ok when the command returns very quickly.

However now some targets may run during several seconds or even minutes, so it should be executed async and the output displayed in the console.

Ideally I’d like to run these commands like ST handles builds, but I need to fire them from my plugin and they are too complex to be “simple” ST builds.

0 Likes

#2

The standard Build command from ST2 is defined in “Sublime Text 2\Packages\Default\exec.py”.
The main command is ExecCommand and you could call it with:

window.run_command("exec", {"cmd": "mycmd"})

Look at the method definition for a complete list of parameter.

If this command doesn’t work for you, copy the source in a new MyExecCommand and adapt the code to your need.
Without more information, we couldn’t know what’s a complex command is.
Feel free to ask more if needed.

0 Likes