Builtins: setenv: Raises a ShellCommandError incase of lack of arguments

This commit is contained in:
Sekulum Forka 2021-05-13 13:36:38 +02:00
parent 285eb06f0e
commit ad3568d785
1 changed files with 3 additions and 1 deletions

View File

@ -226,7 +226,9 @@ proc runBuiltin(builtin: string, args: openArray[string]): string =
return ""
of "setenv":
if args.len < 2:
raise newException(Exception, "setenv: Not enough arguments provided")
var e = newException(ShellCommandError, "Setenv: not enough arguments provided")
e.command="setenv"
raise e
try:
envVariables[args[0]] = args[1..^1].join(":")
putEnv(args[0], args[1..^1].join(":"))