@@ -18,6 +18,7 @@ const ghApiHeaders = {
1818
1919if ( process . env . GITHUB_TOKEN ) {
2020 ghApiHeaders . Authorization = 'Basic ' + Buffer . from ( process . env . GITHUB_TOKEN ) . toString ( 'base64' ) ;
21+ console . error ( 'Using GITHUB_TOKEN for authenticated requests to GitHub API.' ) ;
2122}
2223
2324const ghDownloadHeaders = {
@@ -48,29 +49,29 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
4849 signal : controller . signal
4950 } ) ;
5051 if ( response . ok && ( response . status >= 200 && response . status < 300 ) ) {
51- console . log ( `Fetch completed: Status ${ response . status } .` ) ;
52+ console . error ( `Fetch completed: Status ${ response . status } .` ) ;
5253 const contents = Buffer . from ( await response . arrayBuffer ( ) ) ;
5354 const asset = JSON . parse ( contents . toString ( ) ) . assets . find ( ( a ) => a . name === options . assetName ) ;
5455 if ( ! asset ) {
5556 throw new Error ( `Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${ version } ` ) ;
5657 }
57- console . log ( `Found asset ${ options . assetName } @ ${ asset . url } .` ) ;
58+ console . error ( `Found asset ${ options . assetName } @ ${ asset . url } .` ) ;
5859 const assetResponse = await fetch ( asset . url , {
5960 headers : ghDownloadHeaders
6061 } ) ;
6162 if ( assetResponse . ok && ( assetResponse . status >= 200 && assetResponse . status < 300 ) ) {
6263 const assetContents = Buffer . from ( await assetResponse . arrayBuffer ( ) ) ;
63- console . log ( `Fetched response body buffer: ${ assetContents . byteLength } bytes` ) ;
64+ console . error ( `Fetched response body buffer: ${ assetContents . byteLength } bytes` ) ;
6465 if ( options . checksumSha256 ) {
6566 const actualSHA256Checksum = createHash ( 'sha256' ) . update ( assetContents ) . digest ( 'hex' ) ;
6667 if ( actualSHA256Checksum !== options . checksumSha256 ) {
6768 throw new Error ( `Checksum mismatch for ${ asset . url } (expected ${ options . checksumSha256 } , actual ${ actualSHA256Checksum } )` ) ;
6869 }
6970 }
70- console . log ( `Verified SHA256 checksums match for ${ asset . url } ` ) ;
71+ console . error ( `Verified SHA256 checksums match for ${ asset . url } ` ) ;
7172 const tarCommand = `tar -xz -C ${ options . dest } ` ;
7273 execSync ( tarCommand , { input : assetContents } ) ;
73- console . log ( `Fetch complete!` ) ;
74+ console . error ( `Fetch complete!` ) ;
7475 return ;
7576 }
7677 throw new Error ( `Request ${ asset . url } failed with status code: ${ assetResponse . status } ` ) ;
@@ -81,7 +82,7 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
8182 }
8283 } catch ( e ) {
8384 if ( retries > 0 ) {
84- console . log ( `Fetching failed: ${ e } ` ) ;
85+ console . error ( `Fetching failed: ${ e } ` ) ;
8586 await new Promise ( resolve => setTimeout ( resolve , retryDelay ) ) ;
8687 return fetchUrl ( options , retries - 1 , retryDelay ) ;
8788 }
@@ -122,7 +123,7 @@ async function getSysroot(arch) {
122123 return result ;
123124 }
124125
125- console . log ( `Installing ${ arch } root image: ${ sysroot } ` ) ;
126+ console . error ( `Installing ${ arch } root image: ${ sysroot } ` ) ;
126127 fs . rmSync ( sysroot , { recursive : true , force : true } ) ;
127128 fs . mkdirSync ( sysroot , { recursive : true } ) ;
128129
@@ -139,7 +140,7 @@ async function getSysroot(arch) {
139140
140141async function main ( ) {
141142 const arch = process . argv [ 2 ] || process . env . ARCH || 'x64' ;
142- console . log ( `Installing sysroot for architecture: ${ arch } ` ) ;
143+ console . error ( `Installing sysroot for architecture: ${ arch } ` ) ;
143144
144145 try {
145146 const sysrootPath = await getSysroot ( arch ) ;
0 commit comments