Skip to content

Commit e1de11d

Browse files
committed
Create a new console for each test worker on Windows
The primary motivation to have each test worker running its own console is to allow the windows_mb_path tests to run in parallel. A nice side effect is that this also prevents changing the code page of the tester's console window (which can even cause its font to be changed). To be able to do so, we introduce the `create_new_console` option for `proc_open()`, which might occasionally be useful for other purposes than testing.
1 parent 54ecf57 commit e1de11d

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

ext/standard/proc_open.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,7 @@ PHP_FUNCTION(proc_open)
504504
int bypass_shell = 0;
505505
int blocking_pipes = 0;
506506
int create_process_group = 0;
507+
int create_new_console = 0;
507508
#else
508509
char **argv = NULL;
509510
#endif
@@ -598,6 +599,13 @@ PHP_FUNCTION(proc_open)
598599
create_process_group = 1;
599600
}
600601
}
602+
603+
item = zend_hash_str_find(Z_ARRVAL_P(other_options), "create_new_console", sizeof("create_new_console") - 1);
604+
if (item != NULL) {
605+
if (Z_TYPE_P(item) == IS_TRUE || ((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item))) {
606+
create_new_console = 1;
607+
}
608+
}
601609
}
602610
#endif
603611

@@ -921,7 +929,9 @@ PHP_FUNCTION(proc_open)
921929
if (create_process_group) {
922930
dwCreateFlags |= CREATE_NEW_PROCESS_GROUP;
923931
}
924-
932+
if (create_new_console) {
933+
dwCreateFlags |= CREATE_NEW_CONSOLE;
934+
}
925935
envpw = php_win32_cp_env_any_to_w(env.envp);
926936
if (envpw) {
927937
dwCreateFlags |= CREATE_UNICODE_ENVIRONMENT;

ext/standard/tests/file/windows_mb_path/CONFLICTS

Lines changed: 0 additions & 3 deletions
This file was deleted.

run-tests.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,8 @@ function run_all_tests_parallel($test_files, $env, $redir_tested) {
14241424
"TEST_PHP_URI" => $sockUri,
14251425
],
14261426
[
1427-
"suppress_errors" => TRUE
1427+
"suppress_errors" => TRUE,
1428+
'create_new_console' => TRUE,
14281429
]
14291430
);
14301431
if ($proc === FALSE) {

0 commit comments

Comments
 (0)