Handle OneShot tasks only on Windows

This commit is contained in:
Manuel Thalmann 2024-08-27 21:32:49 +02:00
parent 9dc10b754c
commit 0083cecc6f

View file

@ -29,13 +29,18 @@ $null = New-Module {
function Start-Operation {
param(
[switch] $NonInteractive = ($null -ne (Get-OneShotTask)),
[switch] $NonInteractive,
[switch] $NoImplicitCleanup,
[scriptblock] $Action
)
$cleanup = { };
if ($IsWindows -and ($null -ne (Get-OneShotTask))) {
$taskPending = $true;
[switch] $NonInteractive = $true;
}
if (-not $Global:InOperation) {
if ($env:DEBUG) {
Set-PSDebug -Trace 1;
@ -231,7 +236,7 @@ $null = New-Module {
}
}
if ((Get-OneShotTask)) {
if ($taskPending) {
Start-OneShot;
} else {
& $Action;