runcmd 0.1.1

This library is used for extending `Execute` which is extending `Command` in order to execute commands more easily. Especially made for simple shell commands returning an exit code as a number, stdout and stderr as strings.
Documentation
  • Coverage
  • 41.67%
    5 out of 12 items documented1 out of 8 items with examples
  • Size
  • Source code size: 11.55 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.6 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jaredeh/runcmd
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jaredeh

RunCmd

CI

This library is used for extending Execute which is extending Command in order to execute commands more easily. Especially made for simple shell commands returning an exit code as a number, stdout and stderr as strings.

Usage

use std::process::Command;

use runcmd::RunCmd;

RunCmd::new("echo \"Hello World\"").execute();

verbose

verbose() will print the ins and outs to stdout

RunCmd::new("echo \"Hello World\"")
    .verbose()
    .execute();

shell

shell() sets the executor to run the command in a shell using the underlying Execute::shell rather than Execute::command.

RunCmd::new("echo \"Hello World\"")
    .shell()
    .execute();

executep

executep() runs the command, without returning anything, but panics if the command doesn't succeed. Useful in only the most trival circumstances.

RunCmd::new("echo \"Hello World\"")
    .shell()
    .executep();

execute

execute() runs the command, returning a RunCmdOutput.

let retval: RunCmdOutput = RunCmd::new("echo \"Hello World\"").execute();

It returns the following.

pub struct RunCmdOutput {
    pub cmd: String,
    pub stdout: String,
    pub stderr: String,
    pub exitcode: i32
}