mirror of
https://github.com/godotengine/godot.git
synced 2026-05-12 22:35:35 +00:00
[macOS] Pass parent environment to spawned app instances
(cherry picked from commit 2df02c8463)
This commit is contained in:
committed by
Thaddeus Crews
parent
8402ed6435
commit
46fb015202
@@ -813,6 +813,7 @@ Error OS_MacOS::create_process(const String &p_path, const List<String> &p_argum
|
||||
NSWorkspaceOpenConfiguration *configuration = [[NSWorkspaceOpenConfiguration alloc] init];
|
||||
[configuration setArguments:arguments];
|
||||
[configuration setCreatesNewApplicationInstance:YES];
|
||||
[configuration setEnvironment:[[NSProcessInfo processInfo] environment]];
|
||||
__block dispatch_semaphore_t lock = dispatch_semaphore_create(0);
|
||||
__block Error err = ERR_TIMEOUT;
|
||||
__block pid_t pid = 0;
|
||||
@@ -842,7 +843,11 @@ Error OS_MacOS::create_process(const String &p_path, const List<String> &p_argum
|
||||
} else {
|
||||
Error err = ERR_TIMEOUT;
|
||||
NSError *error = nullptr;
|
||||
NSRunningApplication *app = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:url options:NSWorkspaceLaunchNewInstance configuration:[NSDictionary dictionaryWithObject:arguments forKey:NSWorkspaceLaunchConfigurationArguments] error:&error];
|
||||
NSDictionary *config = @{
|
||||
NSWorkspaceLaunchConfigurationArguments : arguments,
|
||||
NSWorkspaceLaunchConfigurationEnvironment : [[NSProcessInfo processInfo] environment]
|
||||
};
|
||||
NSRunningApplication *app = [[NSWorkspace sharedWorkspace] launchApplicationAtURL:url options:NSWorkspaceLaunchNewInstance configuration:config error:&error];
|
||||
if (error) {
|
||||
err = ERR_CANT_FORK;
|
||||
NSLog(@"Failed to execute: %@", error.localizedDescription);
|
||||
|
||||
Reference in New Issue
Block a user