mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +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
|
|
@ -412,6 +412,15 @@ int OS_Unix::get_process_id() const {
|
|||
return getpid();
|
||||
}
|
||||
|
||||
bool OS_Unix::is_process_running(const ProcessID &p_pid) const {
|
||||
int status = 0;
|
||||
if (waitpid(p_pid, &status, WNOHANG) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OS_Unix::has_environment(const String &p_var) const {
|
||||
return getenv(p_var.utf8().get_data()) != nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue