Skip to content

Commit c47ad32

Browse files
committed
Use built-in getExecOutput
Signed-off-by: CrazyMax <[email protected]>
1 parent aa08745 commit c47ad32

File tree

4 files changed

+15
-45
lines changed

4 files changed

+15
-45
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/exec.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/main.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as mexec from './exec';
21
import * as core from '@actions/core';
32
import * as exec from '@actions/exec';
43
import {issueCommand} from '@actions/core/lib/command';
@@ -31,14 +30,19 @@ async function run(): Promise<void> {
3130
core.endGroup();
3231

3332
core.startGroup(`Extracting available platforms`);
34-
await mexec.exec(`docker`, ['run', '--rm', '--privileged', image], true).then(res => {
35-
if (res.stderr != '' && !res.success) {
36-
throw new Error(res.stderr);
37-
}
38-
const platforms: Platforms = JSON.parse(res.stdout.trim());
39-
core.info(`${platforms.supported.join(',')}`);
40-
setOutput('platforms', platforms.supported.join(','));
41-
});
33+
await exec
34+
.getExecOutput('docker', ['run', '--rm', '--privileged', image], {
35+
ignoreReturnCode: true,
36+
silent: true
37+
})
38+
.then(res => {
39+
if (res.stderr.length > 0 && res.exitCode != 0) {
40+
throw new Error(res.stderr.trim());
41+
}
42+
const platforms: Platforms = JSON.parse(res.stdout.trim());
43+
core.info(`${platforms.supported.join(',')}`);
44+
setOutput('platforms', platforms.supported.join(','));
45+
});
4246
core.endGroup();
4347
} catch (error) {
4448
core.setFailed(error.message);

0 commit comments

Comments
 (0)