private int childResult(WindowsChildRecord child, boolean overlay) { if (child == null) return -1; if (overlay) { IntByReference exitCode = new IntByReference(); WindowsLibC libc = (WindowsLibC) libc(); HANDLE handle = child.getProcess(); libc.WaitForSingleObject(handle, WindowsLibC.INFINITE); libc.GetExitCodeProcess(handle, exitCode); libc.CloseHandle(handle); System.exit(exitCode.getValue()); } return child.getPid(); }
private int childResult(WindowsChildRecord child, boolean overlay) { if (child == null) return -1; if (overlay) { IntByReference exitCode = new IntByReference(); WindowsLibC libc = (WindowsLibC) libc(); HANDLE handle = child.getProcess(); libc.WaitForSingleObject(handle, WindowsLibC.INFINITE); libc.GetExitCodeProcess(handle, exitCode); libc.CloseHandle(handle); System.exit(exitCode.getValue()); } return child.getPid(); }
private int childResult(WindowsChildRecord child, boolean overlay) { if (child == null) return -1; if (overlay) { IntByReference exitCode = new IntByReference(); WindowsLibC libc = (WindowsLibC) libc(); HANDLE handle = child.getProcess(); libc.WaitForSingleObject(handle, WindowsLibC.INFINITE); libc.GetExitCodeProcess(handle, exitCode); libc.CloseHandle(handle); System.exit(exitCode.getValue()); } return child.getPid(); }
private int childResult(WindowsChildRecord child, boolean overlay) { if (child == null) return -1; if (overlay) { IntByReference exitCode = new IntByReference(); WindowsLibC libc = (WindowsLibC) libc(); HANDLE handle = child.getProcess(); libc.WaitForSingleObject(handle, WindowsLibC.INFINITE); libc.GetExitCodeProcess(handle, exitCode); libc.CloseHandle(handle); System.exit(exitCode.getValue()); } return child.getPid(); }
@Override public int waitpid(int pid, int[] status, int flags) { if (pid <= 0) { handler.unimplementedError("waitpid"); } HANDLE h = wlibc().OpenProcess(WindowsLibC.PROCESS_QUERY_INFORMATION, 0, pid); if (h == null) { return -1; // TODO: Throw exception } // Block if ((flags & WaitFlags.WNOHANG.intValue()) != 0) { wlibc().WaitForSingleObject(h, WindowsLibC.INFINITE); } IntByReference exitCode = new IntByReference(); wlibc().GetExitCodeProcess(h, exitCode); wlibc().CloseHandle(h); int code = exitCode.getValue(); if (code == 259) { return 0; } else { status[0] = code; return pid; } }