grunt execution stops batch script

人盡茶涼 提交于 2019-12-23 09:32:23

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/27729999/grunt-execution-stops-batch-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!