This repository was archived by the owner on Oct 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -656,7 +656,7 @@ export class ArduinoApp {
656656
657657 // We always build verbosely but filter the output based on the settings
658658
659- this . _settings . useArduinoCli ? args . push ( "--verbose" ) : args . push ( "--verbose-build" ) ;
659+ this . _settings . useArduinoCli ? args . push ( "--verbose" , "--no-color" ) : args . push ( "--verbose-build" ) ;
660660
661661 if ( verbose && ! this . _settings . useArduinoCli ) {
662662 args . push ( "--verbose-upload" ) ;
@@ -757,16 +757,17 @@ export class ArduinoApp {
757757 const wrapLineCallback = ( callback : ( line : string ) => void ) => {
758758 let buffer = "" ;
759759 let startIndex = 0 ;
760+ const eol = this . useArduinoCli ( ) ? "\n" : os . EOL ;
760761 return ( data : string ) => {
761762 buffer += data ;
762763 while ( true ) {
763- const pos = buffer . indexOf ( os . EOL , startIndex ) ;
764+ const pos = buffer . indexOf ( eol , startIndex ) ;
764765 if ( pos < 0 ) {
765766 startIndex = buffer . length ;
766767 break ;
767768 }
768- const line = buffer . substring ( 0 , pos + os . EOL . length ) ;
769- buffer = buffer . substring ( pos + os . EOL . length ) ;
769+ const line = buffer . substring ( 0 , pos + eol . length ) ;
770+ buffer = buffer . substring ( pos + eol . length ) ;
770771 startIndex = 0 ;
771772 callback ( line ) ;
772773 }
Original file line number Diff line number Diff line change @@ -246,7 +246,11 @@ export function spawn(
246246 }
247247
248248 child . on ( "error" , ( error ) => reject ( { error } ) ) ;
249- child . on ( "exit" , ( code ) => {
249+
250+ // It's important to use use the "close" event instead of "exit" here.
251+ // There could still be buffered data in stdout or stderr when the
252+ // process exits that we haven't received yet.
253+ child . on ( "close" , ( code ) => {
250254 if ( code === 0 ) {
251255 resolve ( { code } ) ;
252256 } else {
You can’t perform that action at this time.
0 commit comments