We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 294b30b commit ca8ef24Copy full SHA for ca8ef24
Commands/Stop-Htmx.ps.ps1
@@ -0,0 +1,33 @@
1
+[ValidatePattern('Stop\p{P}+Htmx')]
2
+param()
3
+function Stop-Htmx {
4
+ <#
5
+ .SYNOPSIS
6
+ Stops an htmx server.
7
+ .DESCRIPTION
8
+ Stops an htmx server running in a background job.
9
+ #>
10
+ [inherit('Stop-Job', Abstract)]
11
+ param()
12
+
13
+ process {
14
+ if ($job) {
15
+ if ($job.HttpListener) {
16
+ $job.HttpListener.Stop()
17
+ }
18
+ $job | Stop-Job
19
+ } else {
20
+ foreach ($existingJob in Get-Job @PSBoundParameters) {
21
+ if ($existingJob.HttpListener) {
22
+ try {
23
+ $existingJob.HttpListener.Stop()
24
+ } catch {
25
+ Write-Verbose "Failed to stop the listener for job $($existingJob.Id): $_"
26
27
28
29
+ $existingJob | Stop-Job
30
31
32
33
+}
0 commit comments