mirror of https://github.com/actions/toolkit
Test passing quiet as argument
parent
f2aa430c9d
commit
652109d32c
|
@ -3,6 +3,7 @@ import * as exec from '@actions/exec'
|
||||||
import * as glob from '@actions/glob'
|
import * as glob from '@actions/glob'
|
||||||
import * as io from '@actions/io'
|
import * as io from '@actions/io'
|
||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
|
import { type } from 'os'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as semver from 'semver'
|
import * as semver from 'semver'
|
||||||
import * as util from 'util'
|
import * as util from 'util'
|
||||||
|
@ -71,11 +72,13 @@ export async function unlinkFile(filePath: fs.PathLike): Promise<void> {
|
||||||
return util.promisify(fs.unlink)(filePath)
|
return util.promisify(fs.unlink)(filePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getVersion(app: string): Promise<string> {
|
async function getVersion(app: string, args?: string[]): Promise<string> {
|
||||||
core.debug(`Checking ${app} --version`)
|
core.debug(`Checking ${app} --version`)
|
||||||
let versionOutput = ''
|
let versionOutput = ''
|
||||||
|
typeof args !== 'undefined' ? args : (args = [])
|
||||||
|
args.push('--version')
|
||||||
try {
|
try {
|
||||||
await exec.exec(`${app} --version`, [], {
|
await exec.exec(`${app}`, args, {
|
||||||
ignoreReturnCode: true,
|
ignoreReturnCode: true,
|
||||||
silent: true,
|
silent: true,
|
||||||
listeners: {
|
listeners: {
|
||||||
|
@ -94,7 +97,7 @@ async function getVersion(app: string): Promise<string> {
|
||||||
|
|
||||||
// Use zstandard if possible to maximize cache performance
|
// Use zstandard if possible to maximize cache performance
|
||||||
export async function getCompressionMethod(): Promise<CompressionMethod> {
|
export async function getCompressionMethod(): Promise<CompressionMethod> {
|
||||||
const versionOutput = await getVersion('zstd')
|
const versionOutput = await getVersion('zstd', ['--quiet'])
|
||||||
core.debug(`versionOutput: ${versionOutput}`)
|
core.debug(`versionOutput: ${versionOutput}`)
|
||||||
const version = semver.clean(versionOutput)
|
const version = semver.clean(versionOutput)
|
||||||
core.debug(`version: ${version}`)
|
core.debug(`version: ${version}`)
|
||||||
|
|
Loading…
Reference in New Issue