duojs / duo

A next-generation package manager for the front-end
3.42k stars 118 forks source link

Stops forcefully exiting the process on error #470

Closed dominicbarnes closed 9 years ago

dominicbarnes commented 9 years ago

I'm starting to parallelize more duo builds in order to be faster and more efficient. I also happen to be in a place with less than perfect internet. When an error is encountered (like a transient timeout) it abruptly stops the entire process, which creates broken state (namely incomplete directories and such) for the next run. The only solution from there is to destroy components/. (or manually search for things that look corrupted)

This changes the behavior of the CLI to not exit abruptly on errors, instead in sets process.exitCode = 1; and allows the code to continue running. (any errors need to be short-circuited with a return to account for the process remaining alive.

dominicbarnes commented 9 years ago

Update: it turns out process.exitCode is not a thing in node 0.10, so I've resorted to an hasError flag that is checked before exiting with 1.