Builtins: set: Throws an exception if not enough arguments are provided
This commit is contained in:
parent
aa528eb717
commit
285eb06f0e
|
@ -164,7 +164,6 @@ proc evalVariable(vari: string): string =
|
||||||
else:
|
else:
|
||||||
var e = newException(ShellVariableError, "No such variable: " & vari)
|
var e = newException(ShellVariableError, "No such variable: " & vari)
|
||||||
e.variable = vari
|
e.variable = vari
|
||||||
e.msg = "No such variable: " & e.variable
|
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
# substitute does a substitution on the stream passed in
|
# substitute does a substitution on the stream passed in
|
||||||
|
@ -220,7 +219,9 @@ proc runBuiltin(builtin: string, args: openArray[string]): string =
|
||||||
case builtin:
|
case builtin:
|
||||||
of "set":
|
of "set":
|
||||||
if args.len < 2:
|
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(" ")
|
shellVariables[args[0]] = args[1..^1].join(" ")
|
||||||
return ""
|
return ""
|
||||||
of "setenv":
|
of "setenv":
|
||||||
|
|
Loading…
Reference in New Issue