Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 31 additions & 5 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55335,6 +55335,7 @@ async function getManifestFromURL() {
return response.result;
}
async function installPython(workingDirectory) {
const stderrLines = [];
const options = {
cwd: workingDirectory,
env: {
Expand All @@ -55347,15 +55348,40 @@ async function installPython(workingDirectory) {
core.info(data.toString().trim());
},
stderr: (data) => {
core.error(data.toString().trim());
const errMsg = data.toString().trim();
core.info(`The value of errMsg is : ${errMsg}`);
if (errMsg) {
stderrLines.push(errMsg);
}
}
}
};
if (utils_1.IS_WINDOWS) {
await exec.exec('powershell', ['./setup.ps1'], options);
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 {
await exec.exec('bash', ['./setup.sh'], options);
catch (err) {
exitCode = 1;
execError = err instanceof Error ? err : new Error(String(err));
}
for (const line of stderrLines) {
if (exitCode !== 0) {
core.error(line);
}
else {
core.warning(line);
}
}
if (execError) {
throw execError;
}
}
async function installCpythonFromRelease(release) {
Expand Down
41 changes: 36 additions & 5 deletions src/install-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export async function getManifestFromURL(): Promise<tc.IToolRelease[]> {
}

async function installPython(workingDirectory: string) {
const stderrLines: string[] = [];
const options: ExecOptions = {
cwd: workingDirectory,
env: {
Expand All @@ -108,15 +109,45 @@ async function installPython(workingDirectory: string) {
core.info(data.toString().trim());
},
stderr: (data: Buffer) => {
core.error(data.toString().trim());
const errMsg = data.toString().trim();
core.info(`The value of errMsg is : ${errMsg}`);
if (errMsg) {
stderrLines.push(errMsg);
}
}
}
};

if (IS_WINDOWS) {
await exec.exec('powershell', ['./setup.ps1'], options);
} else {
await exec.exec('bash', ['./setup.sh'], options);
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) {
if (exitCode !== 0) {
core.error(line);
} else {
core.warning(line);
}
}

if (execError) {
throw execError;
}
}

Expand Down
Loading