Skip to content

Commit

Permalink
fix: execForStdOut should return complete output
Browse files Browse the repository at this point in the history
Previously, the implementation register a listener to `exec` to get a buffer.
But I'm not sure if the buffer contains the complete output or it's just the
first buffer and there might be more.  There's a function in @action/exec:
`getExecOutput`. the new function returns a string and not a buffer.

Fix #47
  • Loading branch information
tony84727 committed Aug 10, 2024
1 parent cd1be81 commit 513b2c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
16 changes: 2 additions & 14 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

17 changes: 3 additions & 14 deletions src/git.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import {exec} from '@actions/exec'
import {exec, getExecOutput} from '@actions/exec'

async function execForStdOut(
commandLine: string,
args?: string[],
cwd?: string
): Promise<string> {
return new Promise((resolve, reject) => {
try {
exec(commandLine, args, {
cwd,
listeners: {
stdout: buffer => resolve(buffer.toString())
}
// eslint-disable-next-line github/no-then
}).catch(reject)
} catch (err) {
reject(err)
}
})
const output = await getExecOutput(commandLine, args, {cwd})
return output.stdout
}
async function getMergeBase(
shaA: string,
Expand Down

0 comments on commit 513b2c4

Please sign in to comment.