I tried figuring out once what the right function would be to quit eshell programmatically. Judging by the naming convention for other commands going by eshell/ls and alike, I expected it to be eshell/quit, but got a funky error instead. Digging deeper revealed the real quit function:
(defun eshell-life-is-too-much () "Kill the current buffer (or bury it). Good-bye Eshell." (interactive) (if (not eshell-kill-on-exit) (bury-buffer) (kill-buffer (current-buffer))))
I have no idea what its author was thinking when devising that name. They’ve refused a comment on it as well, so I’ll just assume eshell to be sort of suicidal.