Skip to content

Commit 7286997

Browse files
committed
TMP
1 parent 5579e8a commit 7286997

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

e2e/rector/expected-output.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
RECTOR:
22
RECTOR: [OK] 1 file has been changed by Rector
33
RECTOR:
4-

src/Upgrade/Step/FractorStepExecutor.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,17 @@ public function run(int $index, UpgradeStep $step): void
5656
],
5757
timeout: 3600
5858
);
59-
$process->run(static function ($type, $data) {
59+
$firstLine = true;
60+
$process->run(static function ($type, $data) use (&$firstLine) {
6061
$data = trim($data);
6162

6263
// TODO do we need to handle CRLF separately here?
6364
$lines = explode("\n", $data);
65+
if (!$firstLine) {
66+
echo array_shift($lines);
67+
} else {
68+
$firstLine = false;
69+
}
6470
$lines = array_map(
6571
static fn (string $line) => "FRACTOR: $line",
6672
$lines

src/Upgrade/Step/RectorStepExecutor.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,22 @@ public function run(int $index, UpgradeStep $step): void
5656
],
5757
timeout: 3600
5858
);
59-
$process->run(static function ($type, $data) {
60-
echo 'RECTOR: ' . $data;
59+
$firstLine = true;
60+
$process->run(static function ($type, $data) use (&$firstLine) {
61+
$data = trim($data);
62+
63+
// TODO do we need to handle CRLF separately here?
64+
$lines = explode("\n", $data);
65+
if (!$firstLine) {
66+
echo array_shift($lines);
67+
} else {
68+
$firstLine = false;
69+
}
70+
$lines = array_map(
71+
static fn (string $line) => "RECTOR: $line",
72+
$lines
73+
);
74+
echo implode("\n", $lines), "\n";
6175
});
6276
}
6377
}

0 commit comments

Comments
 (0)