changeset 29538:d1cb1b0e9c05

Windows: Support opening pipe with non-ASCII characters in command. * liboctave/wrappers/octave-popen2.c (octave_popen2): Use Unicode API to spawn pipe on Windows.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 17 Apr 2021 12:20:54 +0200
parents 93a751f468d9
children b51ba0fdd513
files liboctave/wrappers/octave-popen2.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/wrappers/octave-popen2.c	Sat Apr 17 09:16:41 2021 +0200
+++ b/liboctave/wrappers/octave-popen2.c	Sat Apr 17 12:20:54 2021 +0200
@@ -44,6 +44,8 @@
 #  include <io.h>
 #  define WIN32_LEAN_AND_MEAN 1
 #  include <windows.h>
+
+#  include "uniconv-wrappers.h"
 #else
 #  include <errno.h>
 #  include <fcntl.h>
@@ -137,10 +139,15 @@
 
   command = make_command_string (cmd, args);
 
-  status = CreateProcess (0, command, 0, 0, TRUE, 0, 0, 0, &si, &pi);
+  wchar_t *wcmd = u8_to_wchar (command);
 
   free (command);
 
+  status = CreateProcessW (NULL, wcmd, NULL, NULL, TRUE, CREATE_NO_WINDOW,
+                           NULL, NULL, &si, &pi);
+
+  free (wcmd);
+
   if (! status)
     {
       *errmsg = "popen2: process creation failed";