From 226c44c99c7a6a9f40d216ad95af76e2301f3632 Mon Sep 17 00:00:00 2001 From: Sekulum Forka Date: Wed, 12 May 2021 22:12:58 +0200 Subject: [PATCH] parseCommand: Spaces at the beginning of a command should no longer make the shell crash --- src/fsh.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsh.nim b/src/fsh.nim index 8365824..775ab92 100644 --- a/src/fsh.nim +++ b/src/fsh.nim @@ -191,6 +191,7 @@ proc parseCommand(cmd: string): seq[string] = newitem.add(strm.readSubstitution.newStringStream.substitute) of '$': result.add(strm.readVariable.evalVariable) of ' ': + if (result == @[]) and (newitem == ""): continue result.add(newitem) newitem = "" discard strm.skipSpaces()