From 89578472650c604a19025416a2c1b725cc7db9d7 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Sun, 27 Oct 2019 09:34:33 +0200 Subject: Fix off by one error in execAction When the executed command length is less than or equal to 64 characters in total (including the shell invocation) then echoing the command will raise an exception. This is because `..` is inclusive. So we were trying to take one character too big slice from the command string. --- src/nimgen/external.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/nimgen/external.nim b/src/nimgen/external.nim index cc7a5e8..f76aee4 100644 --- a/src/nimgen/external.nim +++ b/src/nimgen/external.nim @@ -22,7 +22,7 @@ proc execAction*(cmd: string): string = when defined(Linux) or defined(MacOSX): ccmd = "bash -c '" & cmd & "'" - echo "Running '" & ccmd[0..min(64, len(ccmd))] & "'" + echo "Running '" & ccmd[0..min(64, len(ccmd)-1)] & "'" return execProc(ccmd) proc extractZip*(zipfile: string) = -- cgit v1.2.3