You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
[macOS] Fix is_process_running and kill for bundled apps.
This commit is contained in:
@@ -666,6 +666,24 @@ Error OS_MacOS::create_instance(const List<String> &p_arguments, ProcessID *r_ch
|
||||
}
|
||||
}
|
||||
|
||||
bool OS_MacOS::is_process_running(const ProcessID &p_pid) const {
|
||||
NSRunningApplication *app = [NSRunningApplication runningApplicationWithProcessIdentifier:(pid_t)p_pid];
|
||||
if (!app) {
|
||||
return OS_Unix::is_process_running(p_pid);
|
||||
}
|
||||
|
||||
return ![app isTerminated];
|
||||
}
|
||||
|
||||
Error OS_MacOS::kill(const ProcessID &p_pid) {
|
||||
NSRunningApplication *app = [NSRunningApplication runningApplicationWithProcessIdentifier:(pid_t)p_pid];
|
||||
if (!app) {
|
||||
return OS_Unix::kill(p_pid);
|
||||
}
|
||||
|
||||
return [app forceTerminate] ? OK : ERR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
String OS_MacOS::get_unique_id() const {
|
||||
static String serial_number;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user