summary refs log blame commit diff stats
path: root/osx/hexchat.bundle
blob: 01ef77db0b7ebba705a1b559a85d021a89032985 (plain) (tree)
generated by cgit-pink 1.4.1 (git 2.36.1) at 2025-03-18 08:53:58 +0000
"> &writePipe, &secattr, 0); /* might be replaced with MyCreatePipeEx */ ZeroMemory (&sInfo, sizeof (sInfo)); ZeroMemory (&pInfo, sizeof (pInfo)); sInfo.cb = sizeof (sInfo); sInfo.dwFlags = STARTF_USESTDHANDLES; sInfo.hStdInput = NULL; sInfo.hStdOutput = writePipe; sInfo.hStdError = writePipe; CreateProcess (0, commandLine, 0, 0, TRUE, NORMAL_PRIORITY_CLASS | CREATE_NO_WINDOW, 0, 0, &sInfo, &pInfo); CloseHandle (writePipe); start = time (0); while (PeekNamedPipe (readPipe, buffer, 1, &dwRead, &dwAvail, &dwLeft) && timeElapsed < 10) { if (dwRead) { if (ReadFile (readPipe, buffer, sizeof (buffer) - 1, &dwRead, NULL) && dwRead != 0 ) { /* avoid garbage */ buffer[dwRead] = '\0'; xchat_printf (ph, "%s", buffer); } } else { /* this way we'll more likely get full lines */ SleepEx (100, TRUE); } timeElapsed = difftime (time (0), start); } } /* display a newline to separate things */ xchat_printf (ph, "\n"); if (timeElapsed >= 10) { xchat_printf (ph, "Command took too much time to run, execution aborted.\n"); } CloseHandle (readPipe); CloseHandle (pInfo.hProcess); CloseHandle (pInfo.hThread); return XCHAT_EAT_XCHAT; } int xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { ph = plugin_handle; *plugin_name = name; *plugin_desc = desc; *plugin_version = version; xchat_hook_command (ph, "EXEC", XCHAT_PRI_NORM, run_command, "Usage: /EXEC [-O] - execute commands inside XChat", 0); xchat_printf (ph, "%s plugin loaded\n", name); return 1; /* return 1 for success */ } int xchat_plugin_deinit (void) { xchat_printf (ph, "%s plugin unloaded\n", name); return 1; }