diff --git a/src/runtimes/go/builder.ts b/src/runtimes/go/builder.ts index c29384cd7..a987b7e4d 100644 --- a/src/runtimes/go/builder.ts +++ b/src/runtimes/go/builder.ts @@ -1,14 +1,14 @@ import { promises as fs } from 'fs' import { basename } from 'path' -import { runCommand } from '../../utils/shell' +import { shellUtils } from '../../utils/shell' import type { RuntimeName } from '../runtime' const build = async ({ destPath, mainFile, srcDir }: { destPath: string; mainFile: string; srcDir: string }) => { const functionName = basename(srcDir) try { - await runCommand('go', ['build', '-o', destPath, '-ldflags', '-s -w'], { + await shellUtils.runCommand('go', ['build', '-o', destPath, '-ldflags', '-s -w'], { cwd: srcDir, env: { CGO_ENABLED: '0', diff --git a/src/runtimes/rust/builder.ts b/src/runtimes/rust/builder.ts index 435b4e7c1..6f7e208ab 100644 --- a/src/runtimes/rust/builder.ts +++ b/src/runtimes/rust/builder.ts @@ -5,7 +5,7 @@ import tmp from 'tmp-promise' import toml from 'toml' import { FunctionConfig } from '../../config' -import { runCommand } from '../../utils/shell' +import { shellUtils } from '../../utils/shell' import type { RuntimeName } from '../runtime' import { CargoManifest } from './cargo_manifest' @@ -55,7 +55,7 @@ const cargoBuild = async ({ targetDirectory: string }) => { try { - await runCommand('cargo', ['build', '--target', BUILD_TARGET, '--release'], { + await shellUtils.runCommand('cargo', ['build', '--target', BUILD_TARGET, '--release'], { cwd: srcDir, env: { CARGO_TARGET_DIR: targetDirectory, @@ -79,7 +79,7 @@ const cargoBuild = async ({ const checkRustToolchain = async () => { try { - await runCommand('cargo', ['-V']) + await shellUtils.runCommand('cargo', ['-V']) return true } catch { @@ -113,8 +113,8 @@ let toolchainInstallation: Promise // `BUILD_TARGET`. The Promise is saved to `toolchainInstallation`, so // that we run the command just once for multiple Rust functions. const installToolchain = async () => { - await runCommand('rustup', ['default', 'stable']) - await runCommand('rustup', ['target', 'add', BUILD_TARGET]) + await shellUtils.runCommand('rustup', ['default', 'stable']) + await shellUtils.runCommand('rustup', ['target', 'add', BUILD_TARGET]) } const installToolchainOnce = () => { diff --git a/src/utils/shell.ts b/src/utils/shell.ts index 3d1499fe6..30e3cb2a8 100644 --- a/src/utils/shell.ts +++ b/src/utils/shell.ts @@ -1,4 +1,3 @@ import execa from 'execa' -// eslint-disable-next-line unicorn/prefer-export-from -export { execa as runCommand } +export const shellUtils = { runCommand: execa } diff --git a/tests/main.js b/tests/main.js index 91dd60245..0736a0d91 100644 --- a/tests/main.js +++ b/tests/main.js @@ -22,7 +22,7 @@ require('source-map-support').install() // We must require this file first because we need to stub it before the main // functions are required. // eslint-disable-next-line import/order -const shellUtils = require('../dist/utils/shell') +const { shellUtils } = require('../dist/utils/shell') const shellUtilsStub = sinon.stub(shellUtils, 'runCommand')