summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-11-23 09:38:15 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-11-23 09:38:15 -0700
commit90bd46a6d5ba55e4848a09d7d4c6e04e8aa9d62e (patch)
treeeb75ccd051229552ac28942c5957b4266d9619bd
parentb174975eb7a828d77816a9bf8107fc1a3ae597d7 (diff)
downloadorg-mode-90bd46a6d5ba55e4848a09d7d4c6e04e8aa9d62e.tar.gz
ob-sh: robustification
* lisp/ob-sh.el (org-babel-sh-var-to-sh): Wrap end token of heredoc in single quotes which is the best practice. (org-babel-sh-table-or-results): Use `org-babel-script-escape' for more robust parsing of shell output.
-rw-r--r--lisp/ob-sh.el13
1 files changed, 2 insertions, 11 deletions
diff --git a/lisp/ob-sh.el b/lisp/ob-sh.el
index e863864..ebfb870 100644
--- a/lisp/ob-sh.el
+++ b/lisp/ob-sh.el
@@ -100,7 +100,7 @@ var of the same value."
(if (listp el)
(mapcar #'deep-string el)
(org-babel-sh-var-to-sh el sep))))
- (format "$(cat <<BABEL_TABLE\n%s\nBABEL_TABLE\n)"
+ (format "$(cat <<'BABEL_TABLE'\n%s\nBABEL_TABLE\n)"
(orgtbl-to-generic
(deep-string (if (listp (car var)) var (list var)))
(list :sep (or sep "\t")))))
@@ -114,16 +114,7 @@ var of the same value."
"Convert RESULTS to an appropriate elisp value.
If the results look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
- (org-babel-read
- (if (string-match "^\\[.+\\]$" results)
- (org-babel-read
- (concat "'"
- (replace-regexp-in-string
- "\\[" "(" (replace-regexp-in-string
- "\\]" ")" (replace-regexp-in-string
- ", " " " (replace-regexp-in-string
- "'" "\"" results))))))
- results)))
+ (org-babel-script-escape results))
(defun org-babel-sh-initiate-session (&optional session params)
"Initiate a session named SESSION according to PARAMS."