grunt执行停止批处理脚本 [英] grunt execution stops batch script
问题描述
我正在使用cordova和yeoman + angularjs进行开发.我采用了以下文件夹结构(在Windows上输出dir命令):
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
是我运行过的文件夹yo angular
(即yeoman生成器-角度). pgdroid
是用于安装cordova项目的文件夹.
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配置为将HTML开发工作的输出复制到pgdroid\www
文件夹.效果很好.
Grunt is configured to copy output of my HTML dev work to pgdroid\www
folder. It works fine.
现在,为了使事情变得简单,我创建了以下批处理脚本(showapp.bat
):
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 ===
该文件放置在根目录中(请参阅此处共享的第一个输出).执行grunt后,脚本执行停止.我猜这是程序的粗鲁行为.它可能不会返回成功退出代码,这可能是脚本突然停止的原因.
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
的行为类似于.bat
(Windows批处理)文件或 batch 程序.因此,在批处理程序中,如果要执行另一个批处理程序,则必须在其前加上call
前缀.
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
这篇关于grunt执行停止批处理脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!