From 6bb7457824fbff7feb92fb536bdfcfa9445cd80f Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Mon, 24 Mar 2025 19:56:52 +1100 Subject: [PATCH] fix compilation errors in windows --- tests/integration/testmanager.nim | 13 ++++++++----- tests/integration/utils.nim | 6 ++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/integration/testmanager.nim b/tests/integration/testmanager.nim index a41935a2..30c05029 100644 --- a/tests/integration/testmanager.nim +++ b/tests/integration/testmanager.nim @@ -401,13 +401,15 @@ proc closeProcessStreams(test: IntegrationTest) {.async: (raises: []).} = # Windows hangs when attempting to close the test's process streams, so try # to kill the process externally. 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: 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: 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: let eMsg = getCurrentExceptionMsg() 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: discard 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: error "Timeout while forcefully killing windows test process", - port, error = e.msg + testId = test.testId, error = e.msg proc teardownTest(test: IntegrationTest) {.async: (raises: []).} = logScope: diff --git a/tests/integration/utils.nim b/tests/integration/utils.nim index 974ec7d6..c30e9a11 100644 --- a/tests/integration/utils.nim +++ b/tests/integration/utils.nim @@ -1,4 +1,5 @@ import std/os +import std/strformat import pkg/chronos import pkg/chronos/asyncproc import pkg/codex/logutils @@ -67,12 +68,13 @@ proc appendFile*(filename: string, content: string) {.raises: [IOError].} = close(f) when defined(windows): - proc forceKillProcess( + proc forceKillProcess*( processName, matchingCriteria: string ): Future[CommandExResponse] {. async: ( raises: [ - AsyncProcessError, AsyncProcessTimeoutError, CancelledError, ValueError, OSError + AsyncProcessError, AsyncProcessTimeoutError, CancelledError, ValueError, + OSError, ] ) .} =