View source code
Display the source code in std/process.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Function std.process.escapeShellCommand
Escapes an argv-style argument array to be used with spawnShell
,
pipeShell
or executeShell
.
string url = "http://dlang.org/"; executeShell(escapeShellCommand("wget", url, "-O", "dlang-index.html"));
Concatenate multiple
and
escapeShellCommand
escapeShellFileName
results to use shell
redirection or
piping operators.
executeShell(
escapeShellCommand("curl", "http://dlang.org/download.html") ~
"|" ~
escapeShellCommand("grep", "-o", http://\S*\.zip
) ~
">" ~
escapeShellFileName("D download links.txt"));
Prototype
string escapeShellCommand( const(char[][]) args ) pure @safe;
Throws
Exception if any part of the command line contains unescapable characters (NUL on all platforms, as well as CR and LF on Windows).
Authors
Lars Tandle Kyllingstad, Steven Schveighoffer, Vladimir Panteleev