eshell-command-result

eshell-command-result is a compiled Lisp function in `eshell.el'.

(eshell-command-result COMMAND &optional STATUS-VAR)

Execute the given Eshell COMMAND, and return the result.
The result might be any Lisp object.
If STATUS-VAR is a symbol, it will be set to the exit status of the
command. This is the only way to determine whether the value returned
corresponding to a successful execution.