Process the return value of built-ins

* geesh/shell.scm (sh:exec-let): Set the '$?' variable to the return
value of built-in utilities.
This commit is contained in:
Timothy Sample 2018-10-16 19:45:42 -04:00
parent 21b862d326
commit fb493cc5f4
1 changed files with 4 additions and 2 deletions

View File

@ -95,12 +95,14 @@ it cannot be found, return @code{#f}."
((name . value)
(set-var! env name value)))
bindings)
(apply proc env args)))
(let ((exit-val (apply proc env args)))
(set-var! env "?" (number->string exit-val)))))
;; TODO: Functions.
(and=> (search-built-ins name)
(lambda (proc)
;; TODO: Use 'bindings' here.
(apply proc env args)))
(let ((exit-val (apply proc env args)))
(set-var! env "?" (number->string exit-val)))))
(and=> (find-utility env name)
(lambda (path)
(exec-utility env bindings path name args)))