Use ps1 for killing process

next
Sayan Nandan 3 years ago
parent 1dbba0c06e
commit 732a89a43e
No known key found for this signature in database
GPG Key ID: 8BC07A0A4D41DD52

@ -58,7 +58,7 @@ ifeq ($(OS),Windows_NT)
CBUILD := cmd /C $(CBUILD)
CTEST := cmd /C $(CTEST)
# finally add stop command
STOP_SERVER := taskkill.exe /F /IM skyd.exe
STOP_SERVER := Powershell.exe -executionpolicy remotesigned -File ci\windows\stop.ps1
else
# not windows, so archive is easy
ARCHIVE += zip -j ourbundle.zip $(BINARY_SKYSH) $(BINARY_SKYD) $(BINARY_SKYBENCH) $(BINARY_SKYMIGRATE)

@ -0,0 +1,3 @@
$ProcessID=(get-process skyd).id
$encodedCommand = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes("Add-Type -Names 'w' -Name 'k' -M '[DllImport(""kernel32.dll"")]public static extern bool FreeConsole();[DllImport(""kernel32.dll"")]public static extern bool AttachConsole(uint p);[DllImport(""kernel32.dll"")]public static extern bool SetConsoleCtrlHandler(uint h, bool a);[DllImport(""kernel32.dll"")]public static extern bool GenerateConsoleCtrlEvent(uint e, uint p);public static void SendCtrlC(uint p){FreeConsole();AttachConsole(p);GenerateConsoleCtrlEvent(0, 0);}';[w.k]::SendCtrlC($ProcessID)"))
start-process powershell.exe -argument "-nologo -noprofile -executionpolicy bypass -EncodedCommand $encodedCommand"
Loading…
Cancel
Save