From 706985997e18bbf7e0b91b093858a4e98db7db8e Mon Sep 17 00:00:00 2001 From: metagn Date: Fri, 11 Oct 2024 12:17:04 +0300 Subject: [PATCH] use `case` instead of set of int in osproc (#24277) As said in the warning after #21659, a set of ints defaults to `set[range[0..65535]]` which is very large. So in osproc, a `case` statement is used instead of an int set to check for an int being one of 2 values. Also tested all of CI with the warning from #21659 as an error, this seems to be the only remaining case in CI. --- lib/pure/osproc.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 340f345bca..fe98329e67 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -740,7 +740,8 @@ when defined(windows) and not defined(useNimRtl): if poInteractive in result.options: close(result) const errInvalidParameter = 87.int const errFileNotFound = 2.int - if lastError.int in {errInvalidParameter, errFileNotFound}: + case lastError.int + of errInvalidParameter, errFileNotFound: raiseOSError(lastError, "Requested command not found: '" & command & "'. OS error:") else: