make exec display as nice as possible
This commit is contained in:
parent
5d50ec01cb
commit
837557e9c7
@ -57,7 +57,7 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
||||
strcpy (commandLine, "cmd.exe /c ");
|
||||
strcat (commandLine, word_eol[2]);
|
||||
|
||||
CreatePipe (&readPipe, &writePipe, &secattr, 0);
|
||||
CreatePipe (&readPipe, &writePipe, &secattr, 0); /* might be replaced with MyCreatePipeEx */
|
||||
|
||||
ZeroMemory (&sInfo, sizeof (sInfo));
|
||||
ZeroMemory (&pInfo, sizeof (pInfo));
|
||||
@ -77,17 +77,23 @@ run_command (char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
if (ReadFile (readPipe, buffer, sizeof (buffer) - 1, &dwRead, NULL) && dwRead != 0 )
|
||||
{
|
||||
/* avoid garbage */
|
||||
buffer[dwRead] = '\0';
|
||||
xchat_printf (ph, "%s\n", buffer);
|
||||
xchat_printf (ph, "%s", buffer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this way we'll more likely get full lines */
|
||||
SleepEx (100, TRUE);
|
||||
}
|
||||
timeElapsed = difftime (time (0), start);
|
||||
}
|
||||
}
|
||||
|
||||
if (timeElapsed >= 10)
|
||||
{
|
||||
xchat_printf (ph, "Execution took too long, aborting.\n");
|
||||
xchat_printf (ph, "Command took too much time to run, execution aborted.\n");
|
||||
}
|
||||
|
||||
CloseHandle (readPipe);
|
||||
|
Loading…
Reference in New Issue
Block a user