aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2019-10-27 09:34:33 +0200
committerOskari Timperi <oskari.timperi@iki.fi>2019-10-27 09:34:33 +0200
commit89578472650c604a19025416a2c1b725cc7db9d7 (patch)
tree796c54158f236ed2894f43cad80ff7d955013cc1
parent2be81614a9851ec13547bffcfe73c20fec6f7708 (diff)
downloadnimgen-fix-execaction.tar.gz
nimgen-fix-execaction.zip
Fix off by one error in execActionfix-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.
-rw-r--r--src/nimgen/external.nim2
1 files changed, 1 insertions, 1 deletions
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) =