Sublime Forum

Managing multiple build processes

#1

I’ve searched a fair bit for the answer to this but haven’t found the answer. I want to use sublime text to run projects but I keep getting hung up on the same issue.

If I run my project, say a python server, in Sublime Text and rerun it - forgetting to kill the initial process - Sublime’s terminal loses reference to the old process and I have to go manually kill the process - in Activity monitor/Task manager.

Is there a way to manage multiple build processes within Sublime? An actual use case (with isn’t me being silly and forgetting to kill the existing process) would be to have a server running and then run unit tests against it.

I was wondering if this is possible - either natively or with plug in support.

Thanks,
James

0 Likes

#2

i use this build system to automatically kill prev process. its node tho. also kills ALL processes with matching name.

{ "cmd": "node", "$file"], "file_regex": "(...*?):([0-9]+)", "selector": "source.js", "shell":true, "windows": { "cmd": "taskkill", "/F", "/IM", "node.exe", "&", "node", "$file"] }, "linux": { "cmd": "killall node; node", "$file"] } }
or you could use a macro file (or the handy runMultipleCommandscommand) to run following on [F7]
killandrun.sublime-macro

	{ "command": "exec", "args": {"kill": true} },
	{ "command": "build" },
]

Keybinding — User

	{ "keys": "F7"], "command": "run_macro_file", "args": {"file": "res://Packages/User/killandrun.sublime-macro"} },
0 Likes

#3

oh woah, thank you. Looks like that points me in the right direction - I’ll give this a try tonight.

I think something similar would give me the option to have multiple builds like a production, debug and test which all kill their respective last process if it’s still running. That should give me the ability to have some running simultaneously.

Am I right in thinking that as soon as you build a new project you loose the output window for the previous build (the black output console at the bottom) - with no way to bring it back?

Thanks again for your time

0 Likes

#4

access to prev build results is somewhat hidden in Tools>Build Results menu. Previous Result Shift-F4 is probably what you want.

please note that the { "command": "exec", "args": {"kill": true} }, line will most probably kill any running build system. I dont think running multiple “build systems” in parallel directly from sublime will work that well, you might want to look into things like make or ant for that. Or maybe circumvent that with a custom plugin. Yet again, i’d rather tinker with a makefile than extend my editor. just my opinion

anyway please share your finding and workflow when finished. its a great learning resource for others

0 Likes