import * as io from '@actions/io' ; import * as exec from '@actions/exec' ; export default class PowerShellToolRunner { static psPath : string ; static async init ( ) { if ( ! PowerShellToolRunner . psPath ) { PowerShellToolRunner . psPath = await io . which ( "pwsh" , true ) ; } } static async executePowerShellCommand ( command , options = { } ) { await exec . exec ( `"${ PowerShellToolRunner . psPath }" -NoLogo -NoProfile -NonInteractive -Command ${ command }` , [ ] , options ) ; } static async executePowerShellScriptBlock ( scriptBlock , options = { } ) { const exitCode = await exec . exec ( `"${ PowerShellToolRunner . psPath }" -NoLogo -NoProfile -NonInteractive -Command` , [ scriptBlock ] , options ) ; return exitCode ; } }