Skip to content

Commit

Permalink
Use the new getExecOutput function from @actions/exec
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberbeni committed Oct 15, 2024
1 parent d240a1b commit 03a7938
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import * as core from '@actions/core'
import { exec as _exec } from '@actions/exec'
import { getExecOutput } from '@actions/exec'
import * as os from 'os'
import { v5 as _uuid } from 'uuid'

export async function exec(commandLine: string, args: string[]): Promise<string> {
let output = ''
const exitCode = await _exec(commandLine, args, {
listeners: {
stdout: (data: Buffer) => {
output += data.toString()
},
},
})
const { exitCode, stdout } = await getExecOutput(commandLine, args)
if (exitCode != 0) {
throw Error(`Command ${[commandLine, ...args]} exit code: ${exitCode}`)
}
return output.trim()
return stdout.trim()
}

export async function getUuid(url: string, commitHash: string): Promise<string> {
Expand Down

0 comments on commit 03a7938

Please sign in to comment.