Skip to content

Commit

Permalink
Delay return code propagation from exec()
Browse files Browse the repository at this point in the history
  • Loading branch information
edigaryev committed May 15, 2024
1 parent bae7fee commit 7a6bfc6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ export async function run(): Promise<void> {
if (core.getInput('strict') === 'true') {
swiftlintArgs.push('--strict')
}
await exec.exec(
const returnCode = await exec.exec(
path.join(portableSwiftlintDir, 'swiftlint'),
swiftlintArgs,
{
ignoreReturnCode: true,
listeners: {
stdout: (data: Buffer) => {
stdout += data.toString()
Expand Down Expand Up @@ -96,6 +97,8 @@ export async function run(): Promise<void> {
startColumn: entry.character
})
}

process.exit(returnCode)
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
Expand Down

0 comments on commit 7a6bfc6

Please sign in to comment.