Skip to content

Commit 223e98b

Browse files
committed
fix: handle command output buffer changes
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
1 parent 03f4a7b commit 223e98b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

system/Common.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function clean_path(string $path): string
119119
*
120120
* > command('migrate:create SomeMigration');
121121
*
122-
* @return string
122+
* @return false|string
123123
*/
124124
function command(string $command)
125125
{
@@ -185,13 +185,21 @@ function command(string $command)
185185
$params[$arg] = $value;
186186
}
187187

188+
$bufferLevel = ob_get_level();
189+
188190
try {
189191
ob_start();
190192
service('commands')->run($command, $params);
191193

194+
if (ob_get_level() <= $bufferLevel) {
195+
return false;
196+
}
197+
192198
return ob_get_contents();
193199
} finally {
194-
ob_end_clean();
200+
while (ob_get_level() > $bufferLevel) {
201+
ob_end_clean();
202+
}
195203
}
196204
}
197205
}

0 commit comments

Comments
 (0)