mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-06 07:23:10 +00:00
fix compilation errors in windows
This commit is contained in:
parent
b060c8d520
commit
6bb7457824
@ -401,13 +401,15 @@ proc closeProcessStreams(test: IntegrationTest) {.async: (raises: []).} =
|
|||||||
# Windows hangs when attempting to close the test's process streams, so try
|
# Windows hangs when attempting to close the test's process streams, so try
|
||||||
# to kill the process externally.
|
# to kill the process externally.
|
||||||
try:
|
try:
|
||||||
let cmdResult = await test.forceKillProcess("nim.exe", &"-d:TestId {test.testId}")
|
let cmdResult = await forceKillProcess("nim.exe", &"-d:TestId {test.testId}")
|
||||||
if cmdResult.status > 0:
|
if cmdResult.status > 0:
|
||||||
error "Failed to forcefully kill windows test process",
|
error "Failed to forcefully kill windows test process",
|
||||||
port, exitCode = cmdResult.status, stderr = cmdResult.stdError
|
testId = test.testId, exitCode = cmdResult.status, stderr = cmdResult.stdError
|
||||||
else:
|
else:
|
||||||
trace "Successfully killed windows test process by force",
|
trace "Successfully killed windows test process by force",
|
||||||
port, exitCode = cmdResult.status, stdout = cmdResult.stdOutput
|
testId = test.testId,
|
||||||
|
exitCode = cmdResult.status,
|
||||||
|
stdout = cmdResult.stdOutput
|
||||||
except ValueError, OSError:
|
except ValueError, OSError:
|
||||||
let eMsg = getCurrentExceptionMsg()
|
let eMsg = getCurrentExceptionMsg()
|
||||||
error "Failed to forcefully kill windows test process, bad path to command",
|
error "Failed to forcefully kill windows test process, bad path to command",
|
||||||
@ -415,10 +417,11 @@ proc closeProcessStreams(test: IntegrationTest) {.async: (raises: []).} =
|
|||||||
except CancelledError as e:
|
except CancelledError as e:
|
||||||
discard
|
discard
|
||||||
except AsyncProcessError as e:
|
except AsyncProcessError as e:
|
||||||
error "Failed to forcefully kill windows test process", port, error = e.msg
|
error "Failed to forcefully kill windows test process",
|
||||||
|
testId = test.testId, error = e.msg
|
||||||
except AsyncProcessTimeoutError as e:
|
except AsyncProcessTimeoutError as e:
|
||||||
error "Timeout while forcefully killing windows test process",
|
error "Timeout while forcefully killing windows test process",
|
||||||
port, error = e.msg
|
testId = test.testId, error = e.msg
|
||||||
|
|
||||||
proc teardownTest(test: IntegrationTest) {.async: (raises: []).} =
|
proc teardownTest(test: IntegrationTest) {.async: (raises: []).} =
|
||||||
logScope:
|
logScope:
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import std/os
|
import std/os
|
||||||
|
import std/strformat
|
||||||
import pkg/chronos
|
import pkg/chronos
|
||||||
import pkg/chronos/asyncproc
|
import pkg/chronos/asyncproc
|
||||||
import pkg/codex/logutils
|
import pkg/codex/logutils
|
||||||
@ -67,12 +68,13 @@ proc appendFile*(filename: string, content: string) {.raises: [IOError].} =
|
|||||||
close(f)
|
close(f)
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
proc forceKillProcess(
|
proc forceKillProcess*(
|
||||||
processName, matchingCriteria: string
|
processName, matchingCriteria: string
|
||||||
): Future[CommandExResponse] {.
|
): Future[CommandExResponse] {.
|
||||||
async: (
|
async: (
|
||||||
raises: [
|
raises: [
|
||||||
AsyncProcessError, AsyncProcessTimeoutError, CancelledError, ValueError, OSError
|
AsyncProcessError, AsyncProcessTimeoutError, CancelledError, ValueError,
|
||||||
|
OSError,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
.} =
|
.} =
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user