diff --git a/lisp/ob-comint.el b/lisp/ob-comint.el index d12ed4722..21ff0f6e1 100644 --- a/lisp/ob-comint.el +++ b/lisp/ob-comint.el @@ -93,9 +93,9 @@ or user `keyboard-quit' during execution of body." (goto-char comint-last-input-end) (not (save-excursion (and (re-search-forward - comint-prompt-regexp nil t) + (regexp-quote ,eoe-indicator) nil t) (re-search-forward - (regexp-quote ,eoe-indicator) nil t))))) + comint-prompt-regexp nil t))))) (accept-process-output (get-buffer-process (current-buffer))) ;; thought the following this would allow async ;; background running, but I was wrong... diff --git a/lisp/ob-sh.el b/lisp/ob-sh.el index 10c08d4c5..b2d1591e9 100644 --- a/lisp/ob-sh.el +++ b/lisp/ob-sh.el @@ -170,7 +170,13 @@ return the value of the last statement in BODY." (session org-babel-sh-eoe-output t body) (mapc (lambda (line) - (insert line) (comint-send-input nil t) (sleep-for 0.25)) + (insert line) + (comint-send-input nil t) + (while (save-excursion + (goto-char comint-last-input-end) + (not (re-search-forward + comint-prompt-regexp nil t))) + (accept-process-output (get-buffer-process (current-buffer))))) (append (split-string (org-babel-trim body) "\n") (list org-babel-sh-eoe-indicator))))