changeset 29142:1024bc946c95

system: Support non-ASCII characters for asynchronous mode on Windows (bug #59572). * liboctave/wrappers/async-system-wrapper.cc (octave_async_system_wrapper): Use wide character API on Windows.
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 29 Nov 2020 18:02:37 +0100
parents f873857f5f86
children 3000414c60eb
files liboctave/wrappers/async-system-wrapper.c
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/wrappers/async-system-wrapper.c	Sun Nov 29 14:20:08 2020 +0100
+++ b/liboctave/wrappers/async-system-wrapper.c	Sun Nov 29 18:02:37 2020 +0100
@@ -43,6 +43,10 @@
 
 #include "async-system-wrapper.h"
 
+#if defined (OCTAVE_USE_WINDOWS_API)
+#  include "uniconv-wrappers.h"
+#endif
+
 pid_t
 octave_async_system_wrapper (const char *cmd)
 {
@@ -53,17 +57,15 @@
 
 #if defined (OCTAVE_USE_WINDOWS_API)
 
-  STARTUPINFO si;
+  STARTUPINFOW si;
   PROCESS_INFORMATION pi;
 
   ZeroMemory (&si, sizeof (si));
   ZeroMemory (&pi, sizeof (pi));
 
-  char *xcmd = (char *) malloc (strlen (cmd) + 1);
+  wchar_t *xcmd = u8_to_wchar (cmd);
 
-  strcpy (xcmd, cmd);
-
-  if (! CreateProcess (0, xcmd, 0, 0, FALSE, 0, 0, 0, &si, &pi))
+  if (! CreateProcessW (NULL, xcmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
     retval = -1;
   else
     {