Sublime Forum

Multiple cmd in build system?


is it possible to run multiple commands in one build system?

Among other combinations I tried to do something like this:


	{"open", "-a", "/Applications/"},
	{"compass", "compile", "$file_path/.."},
	{"csslint", "$file_path/../assets/css/"}

“selector”: “source.sass”

but nothing seems to work :open_mouth: the cmd array containing arrays doesn’t work either …

any ideas?


Is it possible to compile and execute FORTRAN in one build system?
Python build - dynamic env / multiple cmd

Unfortunately, there is no support for multiple commands in a build system. I ran into this issue when working with java. Your best option is to make a bash file with the commands and have a build system that runs the bash file. I’m not a expert when it comes to build systems, so that’s as far as I can help.

Hope that points you in the right direction.



seriously? … only one command? If its just one command in my build then why would I even need a build system :wink:

The problem with running a shell is that I can’t use the variables provided by Sublime. Mh … maybe as parameter? You guys think that works? Any experience with that?

thanks :smile:



please feel free to support this feature :smile: … ld-system/




I just found out (quite a rookie in build systems) how the command is passed to the OS. Its just a concatenation of the elements in the array, separated by spaces. This means you can enter multiple commands, with a separator that your OS understands. For instance for the windows CMD screen, its an & (or a && and only continues with the next command if the previous succeeded. See also … x?mfr=true , its for XP but worked for me in 7.)

The code below sends the line

to the windows shell.

In linux you can use the ‘;’ to separate commands.

Note: For windows you need to set shell to true for this to work. Not sure is this also needed for other OS. Below is an example for LaTex in Windows (assuming in the PATH has pdflatex, bibtex and sumatrapdf set.)

	"selector": "text.tex.latex",
		"cmd":"pdflatex","$file_base_name","&","bibtex","$file_base_name","&","bibtex","$file_base_name","&","pdflatex","$file_base_name","&","pdflatex","$file_base_name","&","sumatrapdf", "$file_base_name.pdf"]

So your example would be

“selector”: “source.sass”,
“cmd”:{“open”, “-a”, “/Applications/”,"&“compass”, “compile”, “$file_path/…”,"&",“csslint”, “$file_path/…/assets/css/”}

//Not sure if “linux” works
“cmd”:{“open”, “-a”, “/Applications/”,";“compass”, “compile”, “$file_path/…”,";",“csslint”, “$file_path/…/assets/css/”}

Hope this helps!



I am trying to get ST to compile a Latex file using multiple commands: latex, dvips and ps2pdf.

On Linux I tried separating commands with “;” or “|” but only the latex command executes. Any examples of multiple command would be appreciated.



Adding “&” with shell = true worked for me, thanks



I believe what you want to do is to make a “make” file. Sure sublime can run a command on your behalf… but what you’ve got is multiple steps to compiling a document along with different points of failure. It’s not really in the realm of a text editor to do this. Also this would allow your project to be used by others who might not have the same setup as you do.