[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special charact

From: Stefan Monnier
Subject: Re: [elpa] externals/ob-haxe d10f2b1: ob-haxe.el: Escape special characters in shell commands
Date: Fri, 29 Jan 2021 09:29:10 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>  May be either a command in the path, like \"neko\" or the full
> -path to the executable, like \"/usr/local/bin/neko\".  Double
> -quotes must be escaped.  This is run in a shell."
> +path to the executable, like \"/usr/local/bin/neko\".  This is
> +run in a shell."

I think it's not clear what "This is run in a shell" means here.

Typically it either means that the usual "shell preprocessing" will take
place, so you can use $ spaces and quotes to construct a "chunk" of
a command, or it is just an implementation detail (in which case
there's no particular reason to mention it in such docstrings).

> @@ -126,11 +126,13 @@ replaced in this string.")
>            (or (cdr (assq :haxe params))
>                org-babel-haxe-compiler))
>           (org-babel-neko-command
> -          (or (cdr (assq :neko params))
> -              org-babel-neko-command))
> +          (replace-regexp-in-string "\\([ \"]\\)" "\\\\\\1" ; escape double 
> quotes or spaces
> +                                    (or (cdr (assq :neko params))
> +                                        org-babel-neko-command)))

You might want to use `shell-quote-argument` instead, so it also escapes
backslashes, pipes, semi colons and whatnot and generally tries to
ensure that the strings is passed through "as is", so the user doesn't
need to know that the string is used as part of a shell command.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]