@@ -237,6 +237,7 @@ public static function prompt(string $field, $options = null, $validation = null
237237 }
238238
239239 static ::fwrite (STDOUT , $ field . (trim ($ field ) !== '' ? ' ' : '' ) . $ extraOutput . ': ' );
240+ static ::$ lastWrite = 'write ' ;
240241
241242 // Read the input from keyboard.
242243 $ input = trim (static ::$ io ->input ());
@@ -440,7 +441,8 @@ public static function write(string $text = '', ?string $foreground = null, ?str
440441 }
441442
442443 if (static ::$ lastWrite !== 'write ' ) {
443- $ text = PHP_EOL . $ text ;
444+ $ text = PHP_EOL . $ text ;
445+
444446 static ::$ lastWrite = 'write ' ;
445447 }
446448
@@ -455,13 +457,20 @@ public static function write(string $text = '', ?string $foreground = null, ?str
455457 public static function error (string $ text , string $ foreground = 'light_red ' , ?string $ background = null )
456458 {
457459 // Check color support for STDERR
458- $ stdout = static ::$ isColored ;
460+ $ stdout = static ::$ isColored ;
461+
459462 static ::$ isColored = static ::hasColorSupport (STDERR );
460463
461464 if ($ foreground !== '' || (string ) $ background !== '' ) {
462465 $ text = static ::color ($ text , $ foreground , $ background );
463466 }
464467
468+ if (static ::$ lastWrite !== 'write ' ) {
469+ $ text = PHP_EOL . $ text ;
470+
471+ static ::$ lastWrite = 'write ' ;
472+ }
473+
465474 static ::fwrite (STDERR , $ text . PHP_EOL );
466475
467476 // return STDOUT color support
0 commit comments