From f0337637004d7edfb0fd0067e54712efb1f380ee Mon Sep 17 00:00:00 2001 From: George Marques Date: Fri, 29 Apr 2016 13:57:57 -0300 Subject: [PATCH] Implement OS.get_process_ID for Windows Based on code by @ratsdiov. Closes #1733 (cherry picked from commit 2cd8e86aa016fe8c61a48889529aa81284f6d889) --- platform/windows/os_windows.cpp | 5 +++++ platform/windows/os_windows.h | 1 + 2 files changed, 6 insertions(+) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index cad14430e6b..a943d5d6f4a 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -55,6 +55,7 @@ #include "shlobj.h" #include +#include static const WORD MAX_CONSOLE_LINES = 1500; @@ -1875,6 +1876,10 @@ Error OS_Windows::kill(const ProcessID& p_pid) { return ret != 0?OK:FAILED; }; +int OS_Windows::get_process_ID() const { + return _getpid(); +} + Error OS_Windows::set_cwd(const String& p_cwd) { if (_wchdir(p_cwd.c_str())!=0) diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 28bb30b3701..c19eb4174a1 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -241,6 +241,7 @@ public: virtual Error execute(const String& p_path, const List& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL); virtual Error kill(const ProcessID& p_pid); + virtual int get_process_ID() const; virtual bool has_environment(const String& p_var) const; virtual String get_environment(const String& p_var) const;