Skip to content

Commit 9d0d7e0

Browse files
committed
WIP
1 parent 651d9d0 commit 9d0d7e0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Platform.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ private static function detectPlatform($testing = false): string
7777
}
7878
$os = strtolower(PHP_OS);
7979
$arch = php_uname('m');
80+
$arch = str_replace(['AMD64', 'AWD64'], 'amd64', $arch);
81+
$arch = strtolower($arch);
8082

8183
if (strpos($os, 'win') === 0) {
8284
$os = 'windows';

src/ProcessManager.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,13 @@ protected function openProcess(): array
115115
private function handleProcess(array $pipes, bool $streamOutput): string
116116
{
117117
$output = '';
118+
$timeout = DIRECTORY_SEPARATOR === '\\' ? 0 : 1;
118119

119120
while (true) {
120121
$read = array_filter($pipes, 'is_resource');
121122
if (empty($read)) break;
123+
stream_set_blocking($pipes[1], false);
124+
stream_set_blocking($pipes[2], false);
122125

123126
$write = $except = null;
124127

@@ -168,12 +171,16 @@ protected function closeProcess($process): int
168171
return -1;
169172
}
170173

171-
$status = proc_get_status($process);
172-
if ($status['running']) {
174+
// Windows-specific termination sequence
175+
if (DIRECTORY_SEPARATOR === '\\') {
173176
proc_terminate($process);
177+
usleep(100000); // Allow time for termination
178+
$status = proc_get_status($process);
179+
if ($status['running']) {
180+
proc_terminate($process, SIGKILL);
181+
}
174182
}
175183

176-
177184
return proc_close($process);
178185
}
179186
}

0 commit comments

Comments
 (0)