Skip to content

Commit

Permalink
Fix #8: Goals with shell special characters fail
Browse files Browse the repository at this point in the history
Put the goal inside a string to avoid having the shell interpret special
characters.
  • Loading branch information
ljos committed Mar 26, 2015
1 parent c95e3fd commit 88690e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ob-prolog.el
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ called by `org-babel-execute-src-block'"
(defun org-babel-prolog-evaluate-external-process (system goal body)
(let* ((tmp-file (org-babel-temp-file "prolog-"))
(command (concat (format "%s -q -l %s" system tmp-file)
(when goal (concat " -t " goal)))))
(when goal
(concat " -t \""
(replace-regexp-in-string
"\"" "\\\"" goal)
"\"")))))
(write-region (org-babel-chomp body) nil tmp-file nil 'no-message)
(with-temp-buffer
(call-process-shell-command command nil t)
Expand Down

0 comments on commit 88690e8

Please sign in to comment.