简体   繁体   中英

grunt execution stops batch script

I am doing development with cordova and yeoman + angularjs. I have adopted a folder structure as follows (output of dir command on windows):

C:\code\cordova\pg-droid-app>dir
 Volume in drive C is OSDisk
 Volume Serial Number is 404D-C81B

 Directory of C:\code\cordova\pg-droid-app

01/01/2015  03:46 PM    <DIR>          .
01/01/2015  03:46 PM    <DIR>          ..
01/01/2015  03:10 PM    <DIR>          pgdroid
01/01/2015  03:50 PM    <DIR>          pgdroid-app-frontend
01/01/2015  03:50 PM               241 showapp.bat
               1 File(s)            241 bytes
               4 Dir(s)  65,102,319,616 bytes free

pgdroid-app-frontend is the folder I've run yo angular (the yeoman generator-angular). pgdroid is the folder where the cordova project is setup.

Grunt is configured to copy output of my HTML dev work to pgdroid\\www folder. It works fine.

Now to make things easier I've created the following batch script ( showapp.bat ):

echo === Running grunt... ===
cd pgdroid-app-frontend
grunt --force
echo === End Running grunt... ===
echo === Running cordova emulator ===
cd ..\pgdroid
cordova run android
cd ..
echo === End Running cordova emulator ===

The file is placed in the root directory (see the first output shared here). The script execution stops after grunt is executed. I am guessing this is the grunt program behaviour. It perhaps doesn't return a success exit code which may be the reason the script stops abrupt.

Whats the workaround for this?

grunt is somewhat behaves like a .bat (windows batch) file or a batch program. Hence within a batch program, if you want to execute another batch program, you have to prefix call before it.

call grunt --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM