9

Is it possible to run two grunt tasks in one .bat script?

I tried the following:

grunt --param=val1 --force
grunt --param=val2 --force

But only the first task was run. Any ideas?

absynce
  • 1,331
  • 17
  • 29
user2699355
  • 121
  • 1
  • 6

2 Answers2

18

Grunt will exit your BAT when it ends (not sure why, but it does). To ensure you continue running even after grunt exits, you will need to use the "call" function:

call grunt --your-args-here-1
call grunt --your-args-here-2

Note that if the first grunt fail, you will still run the second grunt. I'm not sure how to solve this, and I don't need it, hopefully ^_^

FremyCompany
  • 1,590
  • 11
  • 18
  • 2
    Grunt exits because grunt is a batch file. Calling a batch file in a batch file terminates the current batch and starts the new batch unless you put "call" in front of it. Here is a good explanation on it. http://stackoverflow.com/questions/1103994/how-to-run-multiple-bat-files-within-a-bat-file – John Jun 28 '15 at 22:20
0
start /wait /b "" "grunt --param=val1 --force"
start /wait /b "" "grunt --param=val2 --force"

try that...;)

nephi12
  • 2,351
  • 1
  • 15
  • 25