Builtins: set: Throws an exception if not enough arguments are provided

This commit is contained in:
Sekulum Forka 2021-05-13 11:27:53 +02:00
parent aa528eb717
commit 285eb06f0e
1 changed files with 3 additions and 2 deletions

View File

@ -164,7 +164,6 @@ proc evalVariable(vari: string): string =
else:
var e = newException(ShellVariableError, "No such variable: " & vari)
e.variable = vari
e.msg = "No such variable: " & e.variable
raise e
# substitute does a substitution on the stream passed in
@ -220,7 +219,9 @@ proc runBuiltin(builtin: string, args: openArray[string]): string =
case builtin:
of "set":
if args.len < 2:
raise newException(Exception, "Set: not enough arguments provided")
var e = newException(ShellCommandError, "Set: not enough arguments provided")
e.command="set"
raise e
shellVariables[args[0]] = args[1..^1].join(" ")
return ""
of "setenv":