MCPcopy Create free account
hub / github.com/corrode/write-yourself-a-shell / run

Method run

examples/final.rs:44–67  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

42 }
43
44 fn run(self) {
45 let mut prev_output: Option<Output> = None;
46 for e in self.elements {
47 match e {
48 Element::Cmd(cmd) => {
49 prev_output = cmd.run();
50 }
51 Element::And => {
52 let status = prev_output.expect("no command before &&").status;
53 if !status.success() {
54 break;
55 }
56 prev_output = None;
57 }
58 Element::Or => {
59 let status = prev_output.expect("no command before ||").status;
60 if status.success() {
61 break;
62 }
63 prev_output = None;
64 }
65 }
66 }
67 }
68}
69
70impl<'a> Element<'a> {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected