Skip to content

Commit

Permalink
dosinst: Remove needless sleeps
Browse files Browse the repository at this point in the history
EnumWindows() is not an asynchronous function. No need to sleep after
the function.

No need to wait 3 seconds after showing "Done!" when the stdout is not
a tty.
  • Loading branch information
k-takata committed Oct 12, 2018
1 parent 5f0390c commit cbc819b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/dosinst.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
#define DOSINST
#include "dosinst.h"
#include <io.h>

#define GVIMEXT64_PATH "GvimExt64\\gvimext.dll"
#define GVIMEXT32_PATH "GvimExt32\\gvimext.dll"
Expand Down Expand Up @@ -569,7 +570,6 @@ uninstall_check(int skip_question)
sleep(1); /* wait for uninstaller to start up */
num_windows = 0;
EnumWindows(window_cb, 0);
sleep(1); /* wait for windows to be counted */
if (num_windows == 0)
{
/* Did not find the uninstaller, ask user to press
Expand All @@ -585,9 +585,9 @@ uninstall_check(int skip_question)
{
printf(".");
fflush(stdout);
sleep(1); /* wait for the uninstaller to finish */
num_windows = 0;
EnumWindows(window_cb, 0);
sleep(1); /* wait for windows to be counted */
} while (num_windows > 0);
}
printf("\nDone!\n");
Expand Down Expand Up @@ -2589,7 +2589,7 @@ main(int argc, char **argv)

/* When nothing found exit quietly. If something found wait for
* a little while, so that the user can read the messages. */
if (i)
if (i && _isatty(1))
sleep(3);
exit(0);
}
Expand Down

0 comments on commit cbc819b

Please sign in to comment.