@@ -526,6 +526,7 @@ export function printRascalOutputOnFailure(channel: 'Language Parametric Rascal'
526526
527527 const ZOOM_OUT_FACTOR = 5 ;
528528 const N_LOG_LINES = 100 ;
529+ // We guess some locations where the logs can be, since we cannot easily retrieve those from VS Code.
529530 const TEST_STORAGE_DIRS = [
530531 path . join ( path . resolve ( ) , "uitests" ) , // typical CI path
531532 path . join ( os . tmpdir ( ) , "vscode-uitests" ) // typical local path
@@ -538,24 +539,26 @@ export function printRascalOutputOnFailure(channel: 'Language Parametric Rascal'
538539 console . log ( `***** ${ channel } output for the failed tests: ` ) ;
539540
540541 let foundLogs = false ;
541- for ( const p of TEST_STORAGE_DIRS ) {
542+ for ( const vsCodeDir of TEST_STORAGE_DIRS ) {
542543 try {
543- const logDir = path . join ( p , "settings" , "logs" ) ;
544+ const logDir = path . join ( vsCodeDir , "settings" , "logs" ) ;
544545 if ( existsSync ( logDir ) ) {
545546 for ( const entry of await readdir ( logDir , { recursive : true } ) ) {
546547 if ( entry . includes ( "usethesource.rascalmpl" ) && entry . includes ( channel ) ) {
547- foundLogs = true ;
548+ console . log ( `***** ${ entry } ` ) ;
548549 const contents = await readFile ( path . join ( logDir , entry ) , { encoding : "utf-8" } ) ;
549550 console . log ( contents . split ( '\n' ) . splice ( - N_LOG_LINES ) . join ( '\n' ) ) ;
551+ foundLogs = true ;
550552 }
551553 }
552554 }
553555 } catch ( e ) {
554- console . log ( ' Error capturing output: ' , e ) ;
556+ console . log ( ` Error capturing logs in ${ vsCodeDir } : ` , e ) ;
555557 }
556558 }
557559
558560 if ( ! foundLogs ) {
561+ // Fall back to legacy copy-from-VS Code approach if there were no log files.
559562 const bbp = new BottomBarPanel ( ) ;
560563 try {
561564 for ( let z = 0 ; z < ZOOM_OUT_FACTOR ; z ++ ) {
0 commit comments