From d0ad3af82945828ce19f44f2ecc220c0323065d2 Mon Sep 17 00:00:00 2001 From: lmvysakh Date: Mon, 15 Jun 2026 17:05:51 +0530 Subject: [PATCH 1/5] Code fix for incorrect annotations --- dist/setup/index.js | 19 ++++++++++++++++--- src/install-python.ts | 19 ++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 84d9adb4a..ea3c47805 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -55335,6 +55335,7 @@ async function getManifestFromURL() { return response.result; } async function installPython(workingDirectory) { + const stderrLines = []; const options = { cwd: workingDirectory, env: { @@ -55347,15 +55348,27 @@ async function installPython(workingDirectory) { core.info(data.toString().trim()); }, stderr: (data) => { - core.error(data.toString().trim()); + const line = data.toString().trim(); + if (line) { + stderrLines.push(line); + } } } }; + let exitCode; if (utils_1.IS_WINDOWS) { - await exec.exec('powershell', ['./setup.ps1'], options); + exitCode = await exec.exec('powershell', ['./setup.ps1'], options); } else { - await exec.exec('bash', ['./setup.sh'], options); + exitCode = await exec.exec('bash', ['./setup.sh'], options); + } + for (const line of stderrLines) { + if (exitCode !== 0) { + core.error(line); + } + else { + core.warning(line); + } } } async function installCpythonFromRelease(release) { diff --git a/src/install-python.ts b/src/install-python.ts index bef0161c3..d33a3dbf6 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -96,6 +96,7 @@ export async function getManifestFromURL(): Promise { } async function installPython(workingDirectory: string) { + const stderrLines: string[] = []; const options: ExecOptions = { cwd: workingDirectory, env: { @@ -108,15 +109,27 @@ async function installPython(workingDirectory: string) { core.info(data.toString().trim()); }, stderr: (data: Buffer) => { - core.error(data.toString().trim()); + const line = data.toString().trim(); + if (line) { + stderrLines.push(line); + } } } }; + let exitCode: number; if (IS_WINDOWS) { - await exec.exec('powershell', ['./setup.ps1'], options); + exitCode = await exec.exec('powershell', ['./setup.ps1'], options); } else { - await exec.exec('bash', ['./setup.sh'], options); + exitCode = await exec.exec('bash', ['./setup.sh'], options); + } + + for (const line of stderrLines) { + if (exitCode !== 0) { + core.error(line); + } else { + core.warning(line); + } } } From 85ee74fd6f67a3d15ce027b8af2993cdf7934d4c Mon Sep 17 00:00:00 2001 From: lmvysakh Date: Wed, 17 Jun 2026 15:12:06 +0530 Subject: [PATCH 2/5] Updated variable names --- dist/setup/index.js | 12 ++++++------ src/install-python.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index ea3c47805..dfcdcedf0 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -55348,9 +55348,9 @@ async function installPython(workingDirectory) { core.info(data.toString().trim()); }, stderr: (data) => { - const line = data.toString().trim(); - if (line) { - stderrLines.push(line); + const trimmedLine = data.toString().trim(); + if (trimmedLine) { + stderrLines.push(trimmedLine); } } } @@ -55362,12 +55362,12 @@ async function installPython(workingDirectory) { else { exitCode = await exec.exec('bash', ['./setup.sh'], options); } - for (const line of stderrLines) { + for (const bufferedLine of stderrLines) { if (exitCode !== 0) { - core.error(line); + core.error(bufferedLine); } else { - core.warning(line); + core.warning(bufferedLine); } } } diff --git a/src/install-python.ts b/src/install-python.ts index d33a3dbf6..c6a01c032 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -109,9 +109,9 @@ async function installPython(workingDirectory: string) { core.info(data.toString().trim()); }, stderr: (data: Buffer) => { - const line = data.toString().trim(); - if (line) { - stderrLines.push(line); + const trimmedLine = data.toString().trim(); + if (trimmedLine) { + stderrLines.push(trimmedLine); } } } @@ -124,11 +124,11 @@ async function installPython(workingDirectory: string) { exitCode = await exec.exec('bash', ['./setup.sh'], options); } - for (const line of stderrLines) { + for (const bufferedLine of stderrLines) { if (exitCode !== 0) { - core.error(line); + core.error(bufferedLine); } else { - core.warning(line); + core.warning(bufferedLine); } } } From 5c47e56d9cbd9d0b816f13ef2e7509cc1c150bbb Mon Sep 17 00:00:00 2001 From: lmvysakh Date: Wed, 17 Jun 2026 16:10:53 +0530 Subject: [PATCH 3/5] Updated variables and printed info msgs for testing --- dist/setup/index.js | 15 +++++++++------ src/install-python.ts | 19 +++++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index dfcdcedf0..77c0f6a41 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -55348,9 +55348,10 @@ async function installPython(workingDirectory) { core.info(data.toString().trim()); }, stderr: (data) => { - const trimmedLine = data.toString().trim(); - if (trimmedLine) { - stderrLines.push(trimmedLine); + const errMsg = data.toString().trim(); + core.info(`The value of errMsg is : ${errMsg}`); + if (errMsg) { + stderrLines.push(errMsg); } } } @@ -55358,16 +55359,18 @@ async function installPython(workingDirectory) { let exitCode; if (utils_1.IS_WINDOWS) { exitCode = await exec.exec('powershell', ['./setup.ps1'], options); + core.info(`The value of exitCode inside windows code block is : ${exitCode}`); } else { exitCode = await exec.exec('bash', ['./setup.sh'], options); + core.info(`The value of exitCode inside non-windows code block is : ${exitCode}`); } - for (const bufferedLine of stderrLines) { + for (const line of stderrLines) { if (exitCode !== 0) { - core.error(bufferedLine); + core.error(line); } else { - core.warning(bufferedLine); + core.warning(line); } } } diff --git a/src/install-python.ts b/src/install-python.ts index c6a01c032..a96ba0f22 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -109,9 +109,10 @@ async function installPython(workingDirectory: string) { core.info(data.toString().trim()); }, stderr: (data: Buffer) => { - const trimmedLine = data.toString().trim(); - if (trimmedLine) { - stderrLines.push(trimmedLine); + const errMsg = data.toString().trim(); + core.info(`The value of errMsg is : ${errMsg}`); + if (errMsg) { + stderrLines.push(errMsg); } } } @@ -120,15 +121,21 @@ async function installPython(workingDirectory: string) { let exitCode: number; if (IS_WINDOWS) { exitCode = await exec.exec('powershell', ['./setup.ps1'], options); + core.info( + `The value of exitCode inside windows code block is : ${exitCode}` + ); } else { exitCode = await exec.exec('bash', ['./setup.sh'], options); + core.info( + `The value of exitCode inside non-windows code block is : ${exitCode}` + ); } - for (const bufferedLine of stderrLines) { + for (const line of stderrLines) { if (exitCode !== 0) { - core.error(bufferedLine); + core.error(line); } else { - core.warning(bufferedLine); + core.warning(line); } } } From ff201b9f78a211d7b0f55c8efd872ea94f8e6047 Mon Sep 17 00:00:00 2001 From: lmvysakh Date: Wed, 24 Jun 2026 14:58:11 +0530 Subject: [PATCH 4/5] Code fix --- dist/setup/index.js | 1 + src/install-python.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index 77c0f6a41..5f8ea1e23 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -55343,6 +55343,7 @@ async function installPython(workingDirectory) { ...(utils_1.IS_LINUX && { LD_LIBRARY_PATH: path.join(workingDirectory, 'lib') }) }, silent: true, + ignoreReturnCode: true, listeners: { stdout: (data) => { core.info(data.toString().trim()); diff --git a/src/install-python.ts b/src/install-python.ts index a96ba0f22..91a985f25 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -104,6 +104,7 @@ async function installPython(workingDirectory: string) { ...(IS_LINUX && {LD_LIBRARY_PATH: path.join(workingDirectory, 'lib')}) }, silent: true, + ignoreReturnCode: true, listeners: { stdout: (data: Buffer) => { core.info(data.toString().trim()); From 5705f13c19680ac567939dcd228c63405279c7e4 Mon Sep 17 00:00:00 2001 From: lmvysakh Date: Tue, 30 Jun 2026 17:15:15 +0530 Subject: [PATCH 5/5] Code updation --- dist/setup/index.js | 25 +++++++++++++++++-------- src/install-python.ts | 34 ++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 5f8ea1e23..b72d2dd10 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -55343,7 +55343,6 @@ async function installPython(workingDirectory) { ...(utils_1.IS_LINUX && { LD_LIBRARY_PATH: path.join(workingDirectory, 'lib') }) }, silent: true, - ignoreReturnCode: true, listeners: { stdout: (data) => { core.info(data.toString().trim()); @@ -55357,14 +55356,21 @@ async function installPython(workingDirectory) { } } }; - let exitCode; - if (utils_1.IS_WINDOWS) { - exitCode = await exec.exec('powershell', ['./setup.ps1'], options); - core.info(`The value of exitCode inside windows code block is : ${exitCode}`); + let exitCode = 0; + let execError = null; + try { + if (utils_1.IS_WINDOWS) { + exitCode = await exec.exec('powershell', ['./setup.ps1'], options); + core.info(`The value of exitCode inside windows code block is : ${exitCode}`); + } + else { + exitCode = await exec.exec('bash', ['./setup.sh'], options); + core.info(`The value of exitCode inside non-windows code block is : ${exitCode}`); + } } - else { - exitCode = await exec.exec('bash', ['./setup.sh'], options); - core.info(`The value of exitCode inside non-windows code block is : ${exitCode}`); + catch (err) { + exitCode = 1; + execError = err instanceof Error ? err : new Error(String(err)); } for (const line of stderrLines) { if (exitCode !== 0) { @@ -55374,6 +55380,9 @@ async function installPython(workingDirectory) { core.warning(line); } } + if (execError) { + throw execError; + } } async function installCpythonFromRelease(release) { if (!release.files || release.files.length === 0) { diff --git a/src/install-python.ts b/src/install-python.ts index 91a985f25..4d979031e 100644 --- a/src/install-python.ts +++ b/src/install-python.ts @@ -104,7 +104,6 @@ async function installPython(workingDirectory: string) { ...(IS_LINUX && {LD_LIBRARY_PATH: path.join(workingDirectory, 'lib')}) }, silent: true, - ignoreReturnCode: true, listeners: { stdout: (data: Buffer) => { core.info(data.toString().trim()); @@ -119,17 +118,24 @@ async function installPython(workingDirectory: string) { } }; - let exitCode: number; - if (IS_WINDOWS) { - exitCode = await exec.exec('powershell', ['./setup.ps1'], options); - core.info( - `The value of exitCode inside windows code block is : ${exitCode}` - ); - } else { - exitCode = await exec.exec('bash', ['./setup.sh'], options); - core.info( - `The value of exitCode inside non-windows code block is : ${exitCode}` - ); + let exitCode = 0; + let execError: Error | null = null; + + try { + if (IS_WINDOWS) { + exitCode = await exec.exec('powershell', ['./setup.ps1'], options); + core.info( + `The value of exitCode inside windows code block is : ${exitCode}` + ); + } else { + exitCode = await exec.exec('bash', ['./setup.sh'], options); + core.info( + `The value of exitCode inside non-windows code block is : ${exitCode}` + ); + } + } catch (err) { + exitCode = 1; + execError = err instanceof Error ? err : new Error(String(err)); } for (const line of stderrLines) { @@ -139,6 +145,10 @@ async function installPython(workingDirectory: string) { core.warning(line); } } + + if (execError) { + throw execError; + } } export async function installCpythonFromRelease(release: tc.IToolRelease) {