< Summary - Kestrun — Combined Coverage

Information
Class: Public.Tasks.Remove-KrTask
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Tasks/Remove-KrTask.ps1
Tag: Kestrun/Kestrun@6135d944f8787fb570e4dfbacac6e80312799a86
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 42
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 12/01/2025 - 20:55:19 Line coverage: 0% (0/3) Total lines: 42 Tag: Kestrun/Kestrun@638a27c2dd54103f693f023b6ba5f56a884caafa

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/Tasks/Remove-KrTask.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Removes a finished task from the registry.
 4.DESCRIPTION
 5    Deletes a task after it has completed/faulted/cancelled; does not cancel.
 6.PARAMETER Server
 7    The Kestrun server instance.
 8.PARAMETER Id
 9    Task id to remove.
 10.PARAMETER WhatIf
 11    Shows what would happen if the cmdlet runs. The cmdlet is not run.
 12.PARAMETER Confirm
 13    Prompts you for confirmation before running the cmdlet.
 14.EXAMPLE
 15    Remove-KrTask -Id 'task-id'
 16    Removes the specified task.
 17.NOTES
 18    Requires the Kestrun Task service to be added to the server via Add-KrTasksService.
 19    A task can only be removed if it is in a final state (Completed, Failed, Stopped).
 20    Returns $true if the task was found and removed; $false if the task was not found or could not be removed.
 21    This cmdlet supports ShouldProcess for confirmation prompts.
 22#>
 23function Remove-KrTask {
 24    [KestrunRuntimeApi('Everywhere')]
 25    [CmdletBinding(SupportsShouldProcess)]
 26    [OutputType([bool])]
 27    param(
 28        [Parameter(Mandatory = $false, ValueFromPipeline = $true)]
 29        [Kestrun.Hosting.KestrunHost]$Server,
 30
 31        [Parameter(Mandatory)]
 32        [string]$Id
 33    )
 34    begin {
 035        $Server = Resolve-KestrunServer -Server $Server
 36    }
 37    process {
 038        if ($PSCmdlet.ShouldProcess("Task $Id", 'Remove')) {
 039            return $Server.Tasks.Remove($Id)
 40        }
 41    }
 42}

Methods/Properties

Remove-KrTask()