Exec class

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-02-20 09:01:01 +01:00
parent 2915834633
commit 35a8193474
10 changed files with 171 additions and 104 deletions

View File

@@ -17,7 +17,7 @@
import os from 'os';
import path from 'path';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {Exec} from './exec';
export class Docker {
static get configDir(): string {
@@ -25,11 +25,10 @@ export class Docker {
}
public static async isAvailable(): Promise<boolean> {
const ok: boolean = await exec
.getExecOutput('docker', undefined, {
ignoreReturnCode: true,
silent: true
})
const ok: boolean = await Exec.getExecOutput('docker', undefined, {
ignoreReturnCode: true,
silent: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
core.debug(`Docker.isAvailable cmd err: ${res.stderr}`);
@@ -47,10 +46,10 @@ export class Docker {
}
public static async printVersion(): Promise<void> {
await exec.exec('docker', ['version']);
await Exec.exec('docker', ['version']);
}
public static async printInfo(): Promise<void> {
await exec.exec('docker', ['info']);
await Exec.exec('docker', ['info']);
}
}