简体   繁体   中英

Docker run multiple commands asynchronously and kill both if one fails

I have an angular production build running in a docker container and I would like to run the ng build and ng lint asynchronously.

I saw this answer which means my command would look like ng build --prod & ng lint . The problem is that if the first command fails before the second command finishes, my execution keeps running. (ex: The lint bombs after 10s because of a missed semicolon, but the build finishes after 6 minutes successfully. My command says it was successful even though my lint failed and continues to publish). My solution around this is to have ng build --prod && ng lint but this takes more time to finish.

Is there a way to have both commands run asynchronously and if one of the executions bomb out then the whole command stops?

Please go for something like:-

https://github.com/mysticatea/npm-run-all/blob/HEAD/docs/npm-run-all.md

It gives you various options which will be usefull in all current and future scenarios.

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