diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-01-13 15:16:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-13 15:16:07 +0100 |
commit | d754cf95a2205f279ca01096d32b48e7e62deba8 (patch) | |
tree | ddfe46fc3885cc10cc78347c9a978e9b203310df | |
parent | 7f8ab378e9840ce5ea80b4bad9dcd3094cd0e0bc (diff) | |
parent | 533ed0c7c89fa6068e9c7faf660c9cdbac85381c (diff) |
Merge pull request #45155 from bruvzg/fix_execute_arguments
Fix OS::execute() and OS::create_process() command line argument.
-rw-r--r-- | drivers/unix/os_unix.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 13bb866503..81ba4369a6 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -299,10 +299,15 @@ Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, St if (pid == 0) { // The child process - Vector<char *> args; - args.push_back((char *)p_path.utf8().get_data()); + Vector<CharString> cs; + cs.push_back(p_path.utf8()); for (int i = 0; i < p_arguments.size(); i++) { - args.push_back((char *)p_arguments[i].utf8().get_data()); + cs.push_back(p_arguments[i].utf8()); + } + + Vector<char *> args; + for (int i = 0; i < cs.size(); i++) { + args.push_back((char *)cs[i].get_data()); } args.push_back(0); @@ -335,10 +340,15 @@ Error OS_Unix::create_process(const String &p_path, const List<String> &p_argume // This ensures the process won't go zombie at the end. setsid(); - Vector<char *> args; - args.push_back((char *)p_path.utf8().get_data()); + Vector<CharString> cs; + cs.push_back(p_path.utf8()); for (int i = 0; i < p_arguments.size(); i++) { - args.push_back((char *)p_arguments[i].utf8().get_data()); + cs.push_back(p_arguments[i].utf8()); + } + + Vector<char *> args; + for (int i = 0; i < cs.size(); i++) { + args.push_back((char *)cs[i].get_data()); } args.push_back(0); |