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