diff --git a/docs/generate-examples.ps1 b/docs/generate-examples.ps1 index 6b6e80d6ac..d66d331c5a 100644 --- a/docs/generate-examples.ps1 +++ b/docs/generate-examples.ps1 @@ -3,11 +3,19 @@ # This script generates response documents for ./request-examples function Kill-WebServer { - $tcpConnections = Get-NetTCPConnection -LocalPort 14141 -ErrorAction SilentlyContinue - if ($tcpConnections -ne $null) { + $processId = $null + if ($IsMacOs || $IsLinux) { + $processId = $(lsof -ti:8080) + } + elseif ($IsWindows) { + $processId = $(Get-NetTCPConnection -LocalPort 14141 -ErrorAction SilentlyContinue).OwningProcess + } + + if ($processId -ne $null) { Write-Output "Stopping web server" - Get-Process -Id $tcpConnections.OwningProcess | Stop-Process + Get-Process -Id $processId | Stop-Process } + } function Start-Webserver { diff --git a/docs/home/index.html b/docs/home/index.html index 1b580e172c..28a611e0ab 100644 --- a/docs/home/index.html +++ b/docs/home/index.html @@ -3,7 +3,7 @@
-