File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -656,7 +656,7 @@ export class ArduinoApp {
656
656
657
657
// We always build verbosely but filter the output based on the settings
658
658
659
- this . _settings . useArduinoCli ? args . push ( "--verbose" ) : args . push ( "--verbose-build" ) ;
659
+ this . _settings . useArduinoCli ? args . push ( "--verbose" , "--no-color" ) : args . push ( "--verbose-build" ) ;
660
660
661
661
if ( verbose && ! this . _settings . useArduinoCli ) {
662
662
args . push ( "--verbose-upload" ) ;
@@ -757,16 +757,17 @@ export class ArduinoApp {
757
757
const wrapLineCallback = ( callback : ( line : string ) => void ) => {
758
758
let buffer = "" ;
759
759
let startIndex = 0 ;
760
+ const eol = this . useArduinoCli ( ) ? "\n" : os . EOL ;
760
761
return ( data : string ) => {
761
762
buffer += data ;
762
763
while ( true ) {
763
- const pos = buffer . indexOf ( os . EOL , startIndex ) ;
764
+ const pos = buffer . indexOf ( eol , startIndex ) ;
764
765
if ( pos < 0 ) {
765
766
startIndex = buffer . length ;
766
767
break ;
767
768
}
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 ) ;
770
771
startIndex = 0 ;
771
772
callback ( line ) ;
772
773
}
Original file line number Diff line number Diff line change @@ -246,7 +246,11 @@ export function spawn(
246
246
}
247
247
248
248
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 ) => {
250
254
if ( code === 0 ) {
251
255
resolve ( { code } ) ;
252
256
} else {
You can’t perform that action at this time.
0 commit comments