Pyro

A dynamically-typed, garbage-collected scripting language.

Version 0.24.2

std::cmd


Convenience functions for running common system binaries.

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 cp command as:

cp -rf <src> <dst>

Panics if the cp binary cannot be found or if it exits with a non-zero status code.

git(*args: str) -> str

Equivalent to running the git command with the specified arguments.

Returns the git command's standard output as a string.

Panics if the git binary cannot be found or if it exits with a non-zero status code.

make(*args: str) -> str

Equivalent to running the make command with the specified arguments.

Returns the make command's standard output as a string.

Panics if the make binary cannot be found or if it exits with a non-zero status code.

mkdir(path: str)

Equivalent to running the mkdir command as:

mkdir -p <path>

Panics if the mkdir binary cannot be found or if it exits with a non-zero status code.

mv(src: str, dst: str)

Equivalent to running the mv command as:

mv -f <src> <dst>

Panics if the mv binary cannot be found or if it exits with a non-zero status code.

rm(path: str)

Equivalent to running the rm command as:

rm -rf <path>

Panics if the rm binary 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 stdout output as a string.

  • If path contains a / character, it will be treated as a filepath. Otherwise, the directories specified by the PATH environment 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.