What steps will reproduce the problem?
(1) (with an already-configured and generated “out” directory:)
(2) Run ninja -C out/whatever
(3) Think “oops, I forgot something!”
(4) While looking at “[0/1] Regenerating ninja files”, press control-C or use your favorite method of interruption
(5) You’ll see “ninja: error: rebuilding 'build.ninja': interrupted by user”
(6) Do whatever other thing you meant to do before running ninja
(7) Run ninja -C out/whatever again
What is the expected result?
Ninja files should be regenerated, and the build should begin
What happens instead?
ninja: Entering directory `out/whatever'
ninja: error: loading 'build.ninja': No such file or directory
This is annoying, because *usually* ninja can just trigger regeneration on its own, but not if it was interrupted during regeneration. After an initial “gn gen,” I’m accustomed to only having to interact with an “out” directory by running the ninja command. Having ninja instead spit an error back is a surprising slap.
Suggestion:
During generation, (safely) replace build.ninja with a very small, very simple build.ninja that only knows how to properly generate the ninja build. This would probably the first 10 lines of build.ninja. If you leave that file there during generation, then even if generation is interrupted or fails, “ninja -C out/whatever” will re-attempt generation the next time it’s run.
Comment 1 by dpranke@chromium.org
, Nov 8 2017Status: Duplicate (was: Untriaged)