Prevent pauses in OneShot tasks
This commit is contained in:
parent
93ae3c8e3e
commit
c0f2c25ef6
|
@ -24,6 +24,7 @@ $null = New-Module {
|
|||
|
||||
function Start-Operation {
|
||||
param(
|
||||
[switch] $NonInteractive,
|
||||
[scriptblock] $Action
|
||||
)
|
||||
|
||||
|
@ -33,7 +34,7 @@ $null = New-Module {
|
|||
}
|
||||
|
||||
$Global:InOperation = $true;
|
||||
$Global:ErrorActionPreference = 'Inquire';
|
||||
$Global:ErrorActionPreference = $NonInteractive.IsPresent ? 'Continue' : 'Inquire';
|
||||
$env:WSLENV = "CONFIG_MODULE/p";
|
||||
|
||||
if ($env:CONFIG_MODULE) {
|
||||
|
@ -156,7 +157,7 @@ $null = New-Module {
|
|||
)
|
||||
|
||||
try {
|
||||
Start-Operation @PSBoundParameters;
|
||||
Start-Operation -NonInteractive @PSBoundParameters;
|
||||
}
|
||||
catch {
|
||||
Set-Content -Path $errorPath -Value $Error;
|
||||
|
|
Loading…
Reference in a new issue