help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Dired shell command on file asymchronously


From: Kevin Rodgers
Subject: Re: Dired shell command on file asymchronously
Date: Fri, 24 Jun 2005 15:19:22 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

Josef.Bauer.NOSPAM@web.de wrote:
> I just found that I added a minor improvement in the meantime. Using
> 'shell-quote-argument' file names with spaces and such are working.
>
> Here is the new version:
>
> ;-----------------------------------------------------------------
> (defun dired-do-shell-command-in-background (command)
> "In dired, do shell command in background on the file or directory named on this line."
>   (interactive
> (list (dired-read-shell-command (concat "& on " "%s: ") nil (list (dired-get-filename))))) > (call-process command nil 0 nil (shell-quote-argument (dired-get-filename))))

That doesn't make sense to me.  call-process passes its &rest ARGS
directly to PROGRAM, without any word-splitting etc. by the shell.  So
shell-quote-argument is unecessary, and in fact could introduce quoting
characters that would be interpreted as part of the file name.

If COMMAND is actually a shell command (i.e. with redirection operators
etc.) then you must use shell-command instead of call-process.  If it is
just a program, then using call-process is fine -- but again, using
shell-quote-argument with it is not.

--
Kevin Rodgers





reply via email to

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