summaryrefslogtreecommitdiff
path: root/watch.c
diff options
context:
space:
mode:
authorKent R. Spillner <kspillner@acm.org>2012-03-10 18:35:08 -0600
committerKent R. Spillner <kspillner@acm.org>2012-03-10 18:35:08 -0600
commitf5a3afdcae67938cf7e6040d01a1d51a51e40350 (patch)
treecedfc203c6725a836e06e9e9025254d1326a0470 /watch.c
parent29b62a148267bdb09d8cefa2b47edb59045d37bb (diff)
downloadprocps-ng-f5a3afdcae67938cf7e6040d01a1d51a51e40350.tar.gz
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.
Diffstat (limited to 'watch.c')
-rw-r--r--watch.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/watch.c b/watch.c
index e9ce7c0..e3066f6 100644
--- a/watch.c
+++ b/watch.c
@@ -739,5 +739,7 @@ int main(int argc, char *argv[])
usleep(interval * 1000000);
} while (!exit_early);
- return EXIT_FAILURE;
+ endwin();
+
+ return EXIT_SUCCESS;
}