Skip to content

Commit e37398e

Browse files
committed
fix windows
1 parent e380a65 commit e37398e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/OutputModifiers/CustomOutputModifier.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ class CustomOutputModifier implements OutputModifier
66
{
77
public function modify(string $output = ''): string
88
{
9+
$endMarker = 'TWEAKPHP_END';
10+
$position = strpos($output, $endMarker);
11+
12+
if ($position !== false) {
13+
$output = substr($output, 0, $position);
14+
}
15+
916
// remove only the first tab from each line
1017
return preg_replace('/^ {2}/m', '', $output);
1118
}

src/Tinker.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public function execute(string $phpCode): string
3131

3232
$this->shell->addInput($phpCode);
3333

34+
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
35+
$this->shell->addInput("\necho('TWEAKPHP_END'); exit();");
36+
}
37+
3438
$closure = new ExecutionLoopClosure($this->shell);
3539

3640
$closure->execute();

0 commit comments

Comments
 (0)