I have a plugin that uses subprocesses to call out to another application and uses a custom build system to build the file that the user is working on. When the user builds the file using the build system, the Cancel Build
command is greyed out. Is there something I can do to enable this? I looked in exec.py but didn’t see anything that would help.
Here is the class that inherits Default.exec.ExecCommand:
class ExecuteCondaEnvironmentCommand(Default.exec.ExecCommand, CondaCommand):
"""Override Sublime Text's default ExecCommand with a targeted build."""
def run(self, **kwargs):
"""Run the current Python file with the conda environment's Python executable.
The activated conda environment is retrieved from the Sublime Text
window project data. The Python executable found in the conda
environment's bin directory is used to build the file.
"""
try:
environment = self.project_data['conda_environment']
if sys.platform == 'win32':
executable_path = '{}\\python' .format(environment)
else:
executable_path = '{}/bin/python' .format(environment)
kwargs['cmd'][0] = os.path.normpath(executable_path)
except KeyError:
pass
super(ExecuteCondaEnvironmentCommand, self).run(**kwargs)
And here is the build system that it uses:
{
// target uses the ExecuteCondaEnvironmentCommand found in commands.py
"target": "execute_conda_environment",
"cmd": ["python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}