mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Add OS::is_process_running function.
Adds the is_process_running function to the native OS class and exposes it to script. This is implemented on Windows and Unix platforms. A stub is provided for other platforms that do not support this function. Documentation is updated to reflect new API function.
This commit is contained in:
parent
1b2992799b
commit
f3c1232c59
12 changed files with 56 additions and 0 deletions
|
|
@ -269,6 +269,10 @@ Error OS::kill(int p_pid) {
|
|||
return ::OS::get_singleton()->kill(p_pid);
|
||||
}
|
||||
|
||||
bool OS::is_process_running(int p_pid) const {
|
||||
return ::OS::get_singleton()->is_process_running(p_pid);
|
||||
}
|
||||
|
||||
int OS::get_process_id() const {
|
||||
return ::OS::get_singleton()->get_process_id();
|
||||
}
|
||||
|
|
@ -571,6 +575,7 @@ void OS::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("create_instance", "arguments"), &OS::create_instance);
|
||||
ClassDB::bind_method(D_METHOD("kill", "pid"), &OS::kill);
|
||||
ClassDB::bind_method(D_METHOD("shell_open", "uri"), &OS::shell_open);
|
||||
ClassDB::bind_method(D_METHOD("is_process_running", "pid"), &OS::is_process_running);
|
||||
ClassDB::bind_method(D_METHOD("get_process_id"), &OS::get_process_id);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_environment", "variable"), &OS::get_environment);
|
||||
|
|
|
|||
|
|
@ -173,6 +173,7 @@ public:
|
|||
Error kill(int p_pid);
|
||||
Error shell_open(String p_uri);
|
||||
|
||||
bool is_process_running(int p_pid) const;
|
||||
int get_process_id() const;
|
||||
|
||||
bool has_environment(const String &p_var) const;
|
||||
|
|
|
|||
|
|
@ -152,6 +152,7 @@ public:
|
|||
virtual Error create_instance(const List<String> &p_arguments, ProcessID *r_child_id = nullptr) { return create_process(get_executable_path(), p_arguments, r_child_id); };
|
||||
virtual Error kill(const ProcessID &p_pid) = 0;
|
||||
virtual int get_process_id() const;
|
||||
virtual bool is_process_running(const ProcessID &p_pid) const = 0;
|
||||
virtual void vibrate_handheld(int p_duration_ms = 500);
|
||||
|
||||
virtual Error shell_open(String p_uri);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue