MCPcopy Create free account
hub / github.com/actions/toolkit / exec

Function exec

packages/exec/src/exec.ts:14–28  ·  view source on GitHub ↗
(
  commandLine: string,
  args?: string[],
  options?: im.ExecOptions
)

Source from the content-addressed store, hash-verified

12 * @returns Promise<number> exit code
13 */
14export async function exec(
15 commandLine: string,
16 args?: string[],
17 options?: im.ExecOptions
18): Promise<number> {
19 const commandArgs = tr.argStringToArray(commandLine)
20 if (commandArgs.length === 0) {
21 throw new Error(`Parameter 'commandLine' cannot be null or empty.`)
22 }
23 // Path to tool to execute should be first arg
24 const toolPath = commandArgs[0]
25 args = commandArgs.slice(1).concat(args || [])
26 const runner: tr.ToolRunner = new tr.ToolRunner(toolPath, args, options)
27 return runner.exec()
28}

Callers 5

extract7zFunction · 0.90
extractTarFunction · 0.90
extractZipWinFunction · 0.90
extractZipNixFunction · 0.90
rmRFFunction · 0.85

Calls 1

execMethod · 0.95

Tested by

no test coverage detected