eval and execute: If a builtin has been found, continue onto the next command instead of executing the program by the same name

This commit is contained in:
Sekulum Forka 2021-05-12 22:16:15 +02:00
parent 226c44c99c
commit 69a96bda1b
1 changed files with 2 additions and 0 deletions

View File

@ -253,6 +253,7 @@ proc execute(cmd: string): int =
if progname in builtins:
stdout.write(runBuiltin(progname, args))
result = 0
continue
let ps = startProcess(progname, args=args, options={poUsePath, poParentStreams})
result = ps.waitForExit
ps.close
@ -267,6 +268,7 @@ proc eval(cmd: string): string =
let args = parsed[1..parsed.high]
if progname in builtins:
result = runBuiltin(progname, args)
continue
let ps = startProcess(progname, args=args, options={poUsePath})
result=ps.outputStream.readAll
ps.close