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

Method run

examples/block2.rs:90–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

88
89impl Chain {
90 fn run(self) {
91 let mut prev_output: Option<Output> = None;
92 for e in self.elements {
93 match e {
94 Element::Cmd(cmd) => {
95 prev_output = cmd.run();
96 }
97 Element::And => {
98 let status = prev_output.expect("no command before &&").status;
99 if !status.success() {
100 break;
101 }
102 prev_output = None;
103 }
104 Element::Or => {
105 let status = prev_output.expect("no command before ||").status;
106 if status.success() {
107 break;
108 }
109 prev_output = None;
110 }
111 }
112 }
113 }
114}
115
116impl Element {

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected