]> granicus.if.org Git - php/commitdiff
Flag the easy stuff out of the way, proc_open() is the real beast in here
authorSara Golemon <pollita@php.net>
Mon, 2 Oct 2006 21:02:08 +0000 (21:02 +0000)
committerSara Golemon <pollita@php.net>
Mon, 2 Oct 2006 21:02:08 +0000 (21:02 +0000)
ext/standard/proc_open.c

index 62adfbd38ea8dbf58abe23da95cec66febb85a18..d99996078ff53e7f7fb9eda60777731911ca3023 100644 (file)
@@ -253,7 +253,7 @@ PHP_MINIT_FUNCTION(proc_open)
 }
 /* }}} */
 
-/* {{{ proto int proc_terminate(resource process [, long signal])
+/* {{{ proto int proc_terminate(resource process [, long signal]) U
    kill a process opened by proc_open */
 PHP_FUNCTION(proc_terminate)
 {
@@ -278,7 +278,7 @@ PHP_FUNCTION(proc_terminate)
 }
 /* }}} */
 
-/* {{{ proto int proc_close(resource process)
+/* {{{ proto int proc_close(resource process) U
    close a process opened by proc_open */
 PHP_FUNCTION(proc_close)
 {
@@ -296,7 +296,7 @@ PHP_FUNCTION(proc_close)
 }
 /* }}} */
 
-/* {{{ proto array proc_get_status(resource process)
+/* {{{ proto array proc_get_status(resource process) U
    get information about a process opened by proc_open */
 PHP_FUNCTION(proc_get_status)
 {
@@ -319,7 +319,19 @@ PHP_FUNCTION(proc_get_status)
 
        array_init(return_value);
 
-       add_ascii_assoc_string(return_value, "command", proc->command, 1);
+       if (UG(unicode)) {
+               UChar *ucmd;
+               int ucmd_len;
+
+               if (SUCCESS == php_stream_path_decode(&php_plain_files_wrapper, &ucmd, &ucmd_len, proc->command, strlen(proc->command), REPORT_ERRORS, FG(default_context))) {
+                       add_ascii_assoc_unicodel(return_value, "command", ucmd, ucmd_len, 0);
+               } else {
+                       /* Fallback on original binary string */
+                       add_ascii_assoc_string(return_value, "command", proc->command, 1);
+               }
+       } else {
+               add_ascii_assoc_string(return_value, "command", proc->command, 1);
+       }
        add_ascii_assoc_long(return_value, "pid", (long) proc->child);
        
 #ifdef PHP_WIN32