diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-11-01 14:12:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-01 14:12:33 +0100 |
commit | 4d96d37ca2200fddaa56980a80d69265bedbebae (patch) | |
tree | 05f60739b5a0b5b3910425b4a2c767f30dc0aba9 /core/core_bind.cpp | |
parent | 02ae47154cfb17c42e73dc16b2ca6b8218862d69 (diff) | |
parent | 0b6b8427c81f60f6298491100ceaed3247649539 (diff) |
Merge pull request #54476 from bruvzg/monterey_create_instance
Diffstat (limited to 'core/core_bind.cpp')
-rw-r--r-- | core/core_bind.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/core_bind.cpp b/core/core_bind.cpp index afd82939ca..b1858c6b32 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -235,6 +235,19 @@ int OS::execute(const String &p_path, const Vector<String> &p_arguments, Array r return exitcode; } +int OS::create_instance(const Vector<String> &p_arguments) { + List<String> args; + for (int i = 0; i < p_arguments.size(); i++) { + args.push_back(p_arguments[i]); + } + ::OS::ProcessID pid = 0; + Error err = ::OS::get_singleton()->create_instance(args, &pid); + if (err != OK) { + return -1; + } + return pid; +} + int OS::create_process(const String &p_path, const Vector<String> &p_arguments) { List<String> args; for (int i = 0; i < p_arguments.size(); i++) { @@ -537,6 +550,7 @@ void OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_executable_path"), &OS::get_executable_path); ClassDB::bind_method(D_METHOD("execute", "path", "arguments", "output", "read_stderr"), &OS::execute, DEFVAL(Array()), DEFVAL(false)); ClassDB::bind_method(D_METHOD("create_process", "path", "arguments"), &OS::create_process); + 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("get_process_id"), &OS::get_process_id); |