mirror of https://github.com/aminya/setup-cpp
fix: use fs/promises instead of sync fs
This commit is contained in:
parent
1cbbd6c740
commit
1d9b24d3a2
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
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
|
@ -1,6 +1,6 @@
|
||||||
import { mkdirP } from "@actions/io"
|
import { mkdirP } from "@actions/io"
|
||||||
import { execaSync } from "execa"
|
import { execaSync } from "execa"
|
||||||
import { readFileSync } from "fs"
|
import { readFile } from "fs/promises"
|
||||||
import { tmpdir } from "os"
|
import { tmpdir } from "os"
|
||||||
import path, { join } from "path"
|
import path, { join } from "path"
|
||||||
import { dirname } from "patha"
|
import { dirname } from "patha"
|
||||||
|
@ -35,8 +35,7 @@ export async function setupBrew(_version: string, _setupDir: string, _arch: stri
|
||||||
const installSh = join(brewTempDirectory, "install.sh")
|
const installSh = join(brewTempDirectory, "install.sh")
|
||||||
|
|
||||||
if (process.platform === "linux") {
|
if (process.platform === "linux") {
|
||||||
const installShContent = readFileSync(installSh, "utf-8")
|
const installShContent = await readFile(installSh, "utf-8")
|
||||||
|
|
||||||
installShContent.replace("#!/bin/bash", "")
|
installShContent.replace("#!/bin/bash", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { execaSync } from "execa"
|
import { execaSync } from "execa"
|
||||||
import { chmodSync } from "fs"
|
import { chmod } from "fs/promises"
|
||||||
import { addExeExt, join } from "patha"
|
import { addExeExt, join } from "patha"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
|
@ -31,7 +31,7 @@ describe("setup-gcc", () => {
|
||||||
const main_exe = join(__dirname, addExeExt("main"))
|
const main_exe = join(__dirname, addExeExt("main"))
|
||||||
execaSync("g++", [file, "-o", main_exe], { cwd: __dirname })
|
execaSync("g++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
chmodSync(main_exe, "755")
|
await chmod(main_exe, "755")
|
||||||
}
|
}
|
||||||
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as io from "@actions/io"
|
import * as io from "@actions/io"
|
||||||
import { execaSync } from "execa"
|
import { execaSync } from "execa"
|
||||||
import { chmodSync } from "fs"
|
import { chmod } from "fs/promises"
|
||||||
import { isUrlOnline } from "is-url-online"
|
import { isUrlOnline } from "is-url-online"
|
||||||
import path, { addExeExt } from "patha"
|
import { addExeExt, join } from "patha"
|
||||||
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
|
||||||
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
import { getSpecificVersionAndUrl } from "../../utils/setup/version"
|
||||||
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
import { setupTmpDir, testBin } from "../../utils/tests/test-helpers"
|
||||||
|
@ -98,11 +98,11 @@ describe("setup-llvm", () => {
|
||||||
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
|
expect(process.env.CXX?.includes("clang++")).toBeTruthy()
|
||||||
|
|
||||||
// test compilation
|
// test compilation
|
||||||
const file = path.join(__dirname, "main.cpp")
|
const file = join(__dirname, "main.cpp")
|
||||||
const main_exe = path.join(__dirname, addExeExt("main"))
|
const main_exe = join(__dirname, addExeExt("main"))
|
||||||
execaSync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
execaSync("clang++", [file, "-o", main_exe], { cwd: __dirname })
|
||||||
if (process.platform !== "win32") {
|
if (process.platform !== "win32") {
|
||||||
chmodSync(main_exe, "755")
|
await chmod(main_exe, "755")
|
||||||
}
|
}
|
||||||
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
execaSync(main_exe, { cwd: __dirname, stdio: "inherit" })
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { execRoot } from "admina"
|
import { execRoot } from "admina"
|
||||||
import { info } from "console"
|
import { info } from "console"
|
||||||
import { execa } from "execa"
|
import { execa } from "execa"
|
||||||
import { promises } from "fs"
|
import { chmod, readFile, writeFile } from "fs/promises"
|
||||||
import { DEFAULT_TIMEOUT } from "../installTool"
|
import { DEFAULT_TIMEOUT } from "../installTool"
|
||||||
import { addPath } from "../utils/env/addEnv"
|
import { addPath } from "../utils/env/addEnv"
|
||||||
import { hasNala, isPackageInstalled, setupAptPack } from "../utils/setup/setupAptPack"
|
import { hasNala, isPackageInstalled, setupAptPack } from "../utils/setup/setupAptPack"
|
||||||
import { InstallationInfo } from "../utils/setup/setupBin"
|
import { InstallationInfo } from "../utils/setup/setupBin"
|
||||||
const { readFile, writeFile, chmod } = promises
|
|
||||||
|
|
||||||
export enum LLVMPackages {
|
export enum LLVMPackages {
|
||||||
All,
|
All,
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
import { execRoot, execRootSync } from "admina"
|
import { execRoot, execRootSync } from "admina"
|
||||||
import { GITHUB_ACTIONS } from "ci-info"
|
import { GITHUB_ACTIONS } from "ci-info"
|
||||||
import { promises as fsPromises } from "fs"
|
|
||||||
import { pathExists } from "path-exists"
|
|
||||||
import { addEnv, cpprc_path, sourceCpprc } from "../env/addEnv"
|
|
||||||
import { InstallationInfo } from "./setupBin"
|
|
||||||
const { appendFile } = fsPromises
|
|
||||||
import { info, warning } from "ci-log"
|
import { info, warning } from "ci-log"
|
||||||
import escapeRegex from "escape-string-regexp"
|
import escapeRegex from "escape-string-regexp"
|
||||||
import { execa, ExecaError } from "execa"
|
import { execa, ExecaError } from "execa"
|
||||||
|
import { appendFile } from "fs/promises"
|
||||||
|
import { pathExists } from "path-exists"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
|
import { addEnv, cpprc_path, sourceCpprc } from "../env/addEnv"
|
||||||
|
import { InstallationInfo } from "./setupBin"
|
||||||
|
|
||||||
/* eslint-disable require-atomic-updates */
|
/* eslint-disable require-atomic-updates */
|
||||||
let didUpdate: boolean = false
|
let didUpdate: boolean = false
|
||||||
|
|
Loading…
Reference in New Issue