summaryrefslogtreecommitdiff
path: root/ext/standard/proc_open.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-06-30 15:47:25 +0200
committerAnatol Belski <ab@php.net>2015-07-02 14:22:55 +0200
commit734d907aa4d5f6005c1c32e2d5a229b059954d81 (patch)
tree6b612c877850cb57d254ca59c8291130e1ae9c50 /ext/standard/proc_open.c
parent6de750efb727180f6f594dbfb92c9fb46ed55049 (diff)
downloadphp-git-734d907aa4d5f6005c1c32e2d5a229b059954d81.tar.gz
initial stuff to make allow blocking pipes on windows
Diffstat (limited to 'ext/standard/proc_open.c')
-rw-r--r--ext/standard/proc_open.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 27584ea1f2..cee4728a54 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -461,6 +461,7 @@ PHP_FUNCTION(proc_open)
#ifdef PHP_WIN32
int suppress_errors = 0;
int bypass_shell = 0;
+ int blocking_pipes = 0;
#endif
#if PHP_CAN_DO_PTS
php_file_descriptor_t dev_ptmx = -1; /* master */
@@ -490,6 +491,13 @@ PHP_FUNCTION(proc_open)
bypass_shell = 1;
}
}
+
+ item = zend_hash_str_find(Z_ARRVAL_P(other_options), "blocking_pipes", sizeof("blocking_pipes") - 1);
+ if (item != NULL) {
+ if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) {
+ blocking_pipes = 1;
+ }
+ }
}
#endif
@@ -538,6 +546,7 @@ PHP_FUNCTION(proc_open)
}
#ifdef PHP_WIN32
+ php_stream_set_option(stream, PHP_STREAM_OPTION_PIPE_BLOCKING, blocking_pipes, NULL);
descriptors[ndesc].childend = dup_fd_as_handle((int)fd);
if (descriptors[ndesc].childend == NULL) {
php_error_docref(NULL, E_WARNING, "unable to dup File-Handle for descriptor %d", nindex);