std::cmd
Convenience functions for running common system binaries.
-
The directories listed in the
PATHenvironment variable will be searched for the named binaries. - Arguments are passed directly to the binary and don't need to be shell-escaped.
The run() function can be used to run an arbitrary executable, returning its output as a string.
Functions
-
cp(src: str, dst: str) -
Equivalent to running the
cpcommand as:cp -rf <src> <dst>
Panics if the
cpbinary cannot be found or if it exits with a non-zero status code. -
git(*args: str) -> str -
Equivalent to running the
gitcommand with the specified arguments.Returns the
gitcommand's standard output as a string.Panics if the
gitbinary cannot be found or if it exits with a non-zero status code. -
make(*args: str) -> str -
Equivalent to running the
makecommand with the specified arguments.Returns the
makecommand's standard output as a string.Panics if the
makebinary cannot be found or if it exits with a non-zero status code. -
mkdir(path: str) -
Equivalent to running the
mkdircommand as:mkdir -p <path>
Panics if the
mkdirbinary cannot be found or if it exits with a non-zero status code. -
mv(src: str, dst: str) -
Equivalent to running the
mvcommand as:mv -f <src> <dst>
Panics if the
mvbinary cannot be found or if it exits with a non-zero status code. -
rm(path: str) -
Equivalent to running the
rmcommand as:rm -rf <path>
Panics if the
rmbinary cannot be found or if it exits with a non-zero status code. -
run(path: str, *args: str) -> str -
Runs an arbitrary executable with the specified arguments and returns its
stdoutoutput as a string.-
If
pathcontains a/character, it will be treated as a filepath. Otherwise, the directories specified by thePATHenvironment variable will be searched for the named file. - Panics if the executable cannot be found or if it exits with a non-zero status code.
This function is a convenience wrapper for the superglobal
$run()function. -
If