Proposal: Add showCommandForUser to process:System.Process
Isaac Dupree
ml at isaac.cedarswampstudios.org
Sun Sep 12 21:58:44 EDT 2010
On 09/12/10 08:24, Ian Lynagh wrote:
>
> Add showCommandForUser to process:System.Process
> http://hackage.haskell.org/trac/ghc/ticket/4305
>
> There are many programs (e.g. ghc and Cabal) which run other programs,
> and when run with -v want to show the user what they are running. The
> user then often wants to run the command by hand, in order to debug a
> problem, but this can be tricky when the command or its arguments
> include spaces or other characters treated specially by shells.
*Which* shells, though, can it run in?
My particular example is I use "fish" shell on Linux, which has similar
but not identical quoting-and-special-character rules to Bash.
The convention in the Linux/Unix world these days, I believe (on the
internet and otherwise) is to post commands in a format that works in
Bash / POSIX sh / whatever works in most/all default Unix shells that
currently exist.
It looks like the patch's method of single-quoting everything and adding
the usual trick to quote single-quotes ( '\'' ) should work fine for
shell compatibility as well as user-readability. (Ignoring Windows
conventions I'm not familiar with.) ( Csh/Tcsh looks somewhat hopeless
to add compatibility with: e.g. even in single-quotes in scripts, '!'
needs to be backslash-escaped*. Switching to using backslashes for
everything instead of single-quotes would be way too ugly.
*
http://www.mpi-inf.mpg.de/~uwe/lehre/unixffb/quoting-guide.html#para:csh-tcsh
)
...So, at least from the Linux side of things, +1.
-Isaac
More information about the Libraries
mailing list