diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-05-04 09:02:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 09:02:33 +0200 |
commit | 5022efef02cd671010438ca467e7e4411d177faa (patch) | |
tree | 11bab1eea284fe82ec6f2f76dbe31c866958e2c0 /drivers/unix/os_unix.cpp | |
parent | ed5e0499ff9b043e52086d6e29031b3ab9c9ca32 (diff) | |
parent | f3c1232c5984a540c33841694469febbe951e7a8 (diff) |
Merge pull request #51682 from mdavisprog/os-is-process-running
OS::is_process_running function.
Diffstat (limited to 'drivers/unix/os_unix.cpp')
-rw-r--r-- | drivers/unix/os_unix.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 12e2113364..52a4d538e1 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -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; } |