summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-27 17:32:43 +0200
committerGitHub <noreply@github.com>2018-08-27 17:32:43 +0200
commit72996df656d4ecf8da22a9fe34f2fc73b91b1405 (patch)
tree67098c296027de1899c232c6f96719abedcdacee /platform/windows
parentc1f687c6818883f70c2b7f85577c51ed5ad65c08 (diff)
Revert "Try closing gracefully before terminating process"
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/os_windows.cpp38
-rw-r--r--platform/windows/os_windows.h2
2 files changed, 6 insertions, 34 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 03f2199954..7009df8e57 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -190,28 +190,6 @@ BOOL WINAPI HandlerRoutine(_In_ DWORD dwCtrlType) {
}
}
-BOOL CALLBACK _CloseWindowsEnum(HWND hWnd, LPARAM lParam) {
- DWORD dwID;
-
- GetWindowThreadProcessId(hWnd, &dwID);
-
- if (dwID == (DWORD)lParam) {
- PostMessage(hWnd, WM_CLOSE, 0, 0);
- }
-
- return TRUE;
-}
-
-bool _close_gracefully(const PROCESS_INFORMATION &pi, const DWORD dwStopWaitMsec) {
- if (!EnumWindows(_CloseWindowsEnum, pi.dwProcessId))
- return false;
-
- if (WaitForSingleObject(pi.hProcess, dwStopWaitMsec) != WAIT_OBJECT_0)
- return false;
-
- return true;
-}
-
void OS_Windows::initialize_debugging() {
SetConsoleCtrlHandler(HandlerRoutine, TRUE);
@@ -2464,26 +2442,20 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
return OK;
};
-Error OS_Windows::kill(const ProcessID &p_pid, const int p_max_wait_msec) {
+Error OS_Windows::kill(const ProcessID &p_pid) {
+
ERR_FAIL_COND_V(!process_map->has(p_pid), FAILED);
const PROCESS_INFORMATION pi = (*process_map)[p_pid].pi;
process_map->erase(p_pid);
- Error result;
-
- if (p_max_wait_msec != -1 && _close_gracefully(pi, p_max_wait_msec)) {
- result = OK;
- } else {
- const int ret = TerminateProcess(pi.hProcess, 0);
- result = ret != 0 ? OK : FAILED;
- }
+ const int ret = TerminateProcess(pi.hProcess, 0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
- return result;
-}
+ return ret != 0 ? OK : FAILED;
+};
int OS_Windows::get_process_id() const {
return _getpid();
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 243d4bb328..c9fa46052a 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -259,7 +259,7 @@ public:
virtual uint64_t get_ticks_usec() const;
virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
- virtual Error kill(const ProcessID &p_pid, const int p_stop_max_wait_msec = -1);
+ virtual Error kill(const ProcessID &p_pid);
virtual int get_process_id() const;
virtual bool has_environment(const String &p_var) const;