Alien-uv
view release on metacpan or search on metacpan
libuv/test/runner-win.c view on Meta::CPAN
char* process_get_name(process_info_t *p) {
return p->name;
}
int process_terminate(process_info_t *p) {
if (!TerminateProcess(p->process, 1))
return -1;
return 0;
}
int process_reap(process_info_t *p) {
DWORD exitCode;
if (!GetExitCodeProcess(p->process, &exitCode))
return -1;
return (int)exitCode;
}
void process_cleanup(process_info_t *p) {
CloseHandle(p->process);
CloseHandle(p->stdio_in);
}
static int clear_line(void) {
HANDLE handle;
CONSOLE_SCREEN_BUFFER_INFO info;
COORD coord;
DWORD written;
handle = (HANDLE)_get_osfhandle(fileno(stderr));
if (handle == INVALID_HANDLE_VALUE)
return -1;
if (!GetConsoleScreenBufferInfo(handle, &info))
return -1;
coord = info.dwCursorPosition;
if (coord.Y <= 0)
return -1;
coord.X = 0;
if (!SetConsoleCursorPosition(handle, coord))
return -1;
if (!FillConsoleOutputCharacterW(handle,
0x20,
info.dwSize.X,
coord,
&written)) {
return -1;
}
return 0;
}
void rewind_cursor() {
if (clear_line() == -1) {
/* If clear_line fails (stdout is not a console), print a newline. */
fprintf(stderr, "\n");
}
}
/* Pause the calling thread for a number of milliseconds. */
void uv_sleep(int msec) {
Sleep(msec);
}
( run in 0.413 second using v1.01-cache-2.11-cpan-fa01517f264 )