mirror of https://github.com/aminya/setup-cpp
fix: add timeout for the LLVM installer call
This commit is contained in:
parent
d7596dd449
commit
52047bd03a
|
@ -86,7 +86,7 @@ inputs:
|
||||||
required: false
|
required: false
|
||||||
timeout:
|
timeout:
|
||||||
description: "The timeout for installation of one tool (in minutes)."
|
description: "The timeout for installation of one tool (in minutes)."
|
||||||
default: "10"
|
default: "20"
|
||||||
required: false
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -5,6 +5,7 @@ import { hasNala, isPackageInstalled, setupAptPack } from "../utils/setup/setupA
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
import { promises } from "fs"
|
import { promises } from "fs"
|
||||||
import { info } from "console"
|
import { info } from "console"
|
||||||
|
import { DEFAULT_TIMEOUT } from "../tool"
|
||||||
const { readFile, writeFile, chmod } = promises
|
const { readFile, writeFile, chmod } = promises
|
||||||
|
|
||||||
export async function setupLLVMApt(majorVersion: number): Promise<InstallationInfo> {
|
export async function setupLLVMApt(majorVersion: number): Promise<InstallationInfo> {
|
||||||
|
@ -19,6 +20,7 @@ export async function setupLLVMApt(majorVersion: number): Promise<InstallationIn
|
||||||
await execRoot("bash", ["/tmp/llvm-setup-cpp.sh", `${majorVersion}`, "all"], {
|
await execRoot("bash", ["/tmp/llvm-setup-cpp.sh", `${majorVersion}`, "all"], {
|
||||||
stdio: "inherit",
|
stdio: "inherit",
|
||||||
shell: true,
|
shell: true,
|
||||||
|
timeout: DEFAULT_TIMEOUT,
|
||||||
})
|
})
|
||||||
|
|
||||||
await addPath(`${installationFolder}/bin`)
|
await addPath(`${installationFolder}/bin`)
|
||||||
|
|
|
@ -96,7 +96,7 @@ async function main(args: string[]): Promise<number> {
|
||||||
setupCppDir,
|
setupCppDir,
|
||||||
successMessages,
|
successMessages,
|
||||||
errorMessages,
|
errorMessages,
|
||||||
parseFloat(opts.timeout ?? "10"),
|
parseFloat(opts.timeout ?? "20") * 60 * 1000,
|
||||||
)
|
)
|
||||||
time2 = Date.now()
|
time2 = Date.now()
|
||||||
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
|
info(`took ${timeFormatter.format(time1, time2) || "0 seconds"}`)
|
||||||
|
|
|
@ -69,6 +69,8 @@ export type ToolName = keyof typeof setups
|
||||||
/** The tools that can be installed */
|
/** The tools that can be installed */
|
||||||
export const tools = Object.keys(setups) as Array<ToolName>
|
export const tools = Object.keys(setups) as Array<ToolName>
|
||||||
|
|
||||||
|
export const DEFAULT_TIMEOUT = 20 * 60 * 1000 // 20 minutes
|
||||||
|
|
||||||
export async function installTool(
|
export async function installTool(
|
||||||
tool: ToolName,
|
tool: ToolName,
|
||||||
version: string,
|
version: string,
|
||||||
|
@ -77,7 +79,7 @@ export async function installTool(
|
||||||
setupCppDir: string,
|
setupCppDir: string,
|
||||||
successMessages: string[],
|
successMessages: string[],
|
||||||
errorMessages: string[],
|
errorMessages: string[],
|
||||||
timeout: number = 0.1,
|
timeout: number = DEFAULT_TIMEOUT,
|
||||||
) {
|
) {
|
||||||
startGroup(`Installing ${tool} ${version}`)
|
startGroup(`Installing ${tool} ${version}`)
|
||||||
let hasLLVM = false
|
let hasLLVM = false
|
||||||
|
|
Loading…
Reference in New Issue