Implement OS.get_process_ID for Windows
Based on code by @ratsdiov. Closes #1733
This commit is contained in:
parent
18c09acf9f
commit
2cd8e86aa0
|
@ -55,6 +55,7 @@
|
||||||
|
|
||||||
#include "shlobj.h"
|
#include "shlobj.h"
|
||||||
#include <regstr.h>
|
#include <regstr.h>
|
||||||
|
#include <process.h>
|
||||||
|
|
||||||
static const WORD MAX_CONSOLE_LINES = 1500;
|
static const WORD MAX_CONSOLE_LINES = 1500;
|
||||||
|
|
||||||
|
@ -1884,6 +1885,10 @@ Error OS_Windows::kill(const ProcessID& p_pid) {
|
||||||
return ret != 0?OK:FAILED;
|
return ret != 0?OK:FAILED;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int OS_Windows::get_process_ID() const {
|
||||||
|
return _getpid();
|
||||||
|
}
|
||||||
|
|
||||||
Error OS_Windows::set_cwd(const String& p_cwd) {
|
Error OS_Windows::set_cwd(const String& p_cwd) {
|
||||||
|
|
||||||
if (_wchdir(p_cwd.c_str())!=0)
|
if (_wchdir(p_cwd.c_str())!=0)
|
||||||
|
|
|
@ -245,6 +245,7 @@ public:
|
||||||
|
|
||||||
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);
|
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);
|
||||||
virtual Error kill(const ProcessID& p_pid);
|
virtual Error kill(const ProcessID& p_pid);
|
||||||
|
virtual int get_process_ID() const;
|
||||||
|
|
||||||
virtual bool has_environment(const String& p_var) const;
|
virtual bool has_environment(const String& p_var) const;
|
||||||
virtual String get_environment(const String& p_var) const;
|
virtual String get_environment(const String& p_var) const;
|
||||||
|
|
Loading…
Reference in New Issue