watch: exit cleanly when falling through main loop.

Revert commit ffe5e0b08eb981b862bab8220f0b9fcf48b7fc4f.  Restores
clean exit when falling through main loop.

Previously, watch only exited when there was an error or when
interrupted by the user.  Commit 81f64657ba183ee983ea98c7f97904296b2ce5aa
added another exit condition when the watched command's output
changes, causing execution to fall out of the main loop.

With this change, watch correctly restores the terminal and returns
an exit code indicating success when invoked with the --chgexit/-g
options.
This commit is contained in:
Kent R. Spillner 2012-03-10 18:35:08 -06:00
parent 29b62a1482
commit f5a3afdcae

View File

@ -739,5 +739,7 @@ int main(int argc, char *argv[])
usleep(interval * 1000000); usleep(interval * 1000000);
} while (!exit_early); } while (!exit_early);
return EXIT_FAILURE; endwin();
return EXIT_SUCCESS;
} }