Home Download Buy Blog Forum Support

multiple cmd in build system?

multiple cmd in build system?

Postby markus.falk on Thu Dec 29, 2011 12:42 pm

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

Among other combinations I tried to do something like this:

Code: Select all
{
   "cmd":
    [
         {"open", "-a", "/Applications/Firefox.app"},
         {"compass", "compile", "$file_path/.."},
         {"csslint", "$file_path/../assets/css/"}
   ],

   "selector": "source.sass"
}


but nothing seems to work :shock: the cmd array containing arrays doesn't work either ...

any ideas?
markus.falk
 
Posts: 18
Joined: Wed Aug 31, 2011 2:10 pm

Re: multiple cmd in build system?

Postby C0D312 on Thu Dec 29, 2011 1:44 pm

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.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: multiple cmd in build system?

Postby markus.falk on Fri Dec 30, 2011 9:54 am

seriously? ... only one command? If its just one command in my build then why would I even need a build system ;) ...

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 :)
markus.falk
 
Posts: 18
Joined: Wed Aug 31, 2011 2:10 pm

Re: multiple cmd in build system?

Postby markus.falk on Mon Jan 02, 2012 10:36 pm

please feel free to support this feature :) http://sublimetext.userecho.com/topic/8 ... ld-system/
markus.falk
 
Posts: 18
Joined: Wed Aug 31, 2011 2:10 pm

Re: multiple cmd in build system?

Postby -?!- on Mon Jan 16, 2012 11:51 am

Hi,

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 http://www.microsoft.com/resources/docu ... x?mfr=true , its for XP but worked for me in 7.)

The code below sends the line
pdflatex final_text & bibtex final_text & bibtex final_text & pdflatex final_text & pdflatex final_text & sumatrapdf final_text.pdf
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.)

Code: Select all
{
   "selector": "text.tex.latex",
   "working_dir":"$file_path",
   "shell":true,
   "windows":
   {
      "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

Code: Select all
"selector": "source.sass",
"shell":true,
"windows":
{
   "cmd":{"open", "-a", "/Applications/Firefox.app","&"compass", "compile", "$file_path/..","&","csslint", "$file_path/../assets/css/"}
},

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


Hope this helps!
-?!-
 
Posts: 1
Joined: Mon Jan 16, 2012 11:33 am

Re: multiple cmd in build system?

Postby raspoutyne on Tue Jan 31, 2012 1:54 pm

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.
raspoutyne
 
Posts: 1
Joined: Tue Jan 31, 2012 1:51 pm

Re: multiple cmd in build system?

Postby daverogers on Mon Feb 20, 2012 2:31 am

Adding "&" with shell = true worked for me, thanks
daverogers
 
Posts: 6
Joined: Tue Aug 02, 2011 9:55 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Yahoo [Bot] and 27 guests