标签:time console running 同步 als force tps https erro
(1)同步标记任务失败
//标记失败任务 module.exports = grunt => { grunt.registerTask(‘bad‘,()=>{ console.log(‘bad working~‘); return false; }); grunt.registerTask(‘foo‘,()=>{ console.log(‘foo task~‘); }) grunt.registerTask(‘bar‘,()=>{ console.log(‘bar task~‘); }) grunt.registerTask(‘default‘,[‘foo‘,‘bad‘,‘bar‘]) }
执行命令,yarn grunt
运行结果如下,当执行到bad任务时,报错,接下来的bar任务不再继续执行。
yarn run v1.22.10 $ C:\studyDemo\grunt-sample\node_modules\.bin\grunt Running "foo" task foo task~ Running "bad" task bad working~ Warning: Task "bad" failed. Use --force to continue. Aborted due to warnings. error Command failed with exit code 3. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
如果想要即使任务失败了,也要后续任务全部执行完,执行命令为yarn grunt --force,执行结果为下
yarn run v1.22.10 $ C:\studyDemo\grunt-sample\node_modules\.bin\grunt --force Running "foo" task foo task~ Running "bad" task bad working~ Warning: Task "bad" failed. Used --force, continuing. Running "bar" task bar task~ Done, but with warnings. Done in 0.95s.
(2)异步标记任务失败
// grunt的异步任务标记任务失败,需要给异步的回调函数指定一个false的实参,就可以标记为这个任务失败了 grunt.registerTask(‘bad-async‘,function(){ const done = this.async(); setTimeout(()=>{ console.log(‘bad async‘); done(false); },1000) })
标签:time console running 同步 als force tps https erro
原文地址:https://www.cnblogs.com/phantomyy/p/14476027.html