File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -145,15 +145,16 @@ fn test_pipe() {
145145 assert ! ( run_cmd!( false | wc) . is_err( ) ) ;
146146 assert ! ( run_cmd!( echo xx | false | wc | wc | wc) . is_err( ) ) ;
147147
148- set_pipefail ( false ) ;
148+ let _pipefail = ScopedPipefail :: set ( false ) ;
149149 assert ! ( run_cmd!( du -ah . | sort -hr | head -n 10 ) . is_ok( ) ) ;
150- set_pipefail ( true ) ;
150+ let _pipefail = ScopedPipefail :: set ( true ) ;
151151
152152 let wc_cmd = "wc" ;
153153 assert ! ( run_cmd!( ls | $wc_cmd) . is_ok( ) ) ;
154+ }
154155
155- // test `ignore` command and pipefail mode
156- // FIXME: make set_pipefail() thread safe, then move this to a separate test_ignore_and_pipefail()
156+ # [ test]
157+ fn test_ignore_and_pipefail ( ) {
157158 struct TestCase {
158159 /// Run the test case, returning whether the result `.is_ok()`.
159160 code : fn ( ) -> bool ,
@@ -261,14 +262,14 @@ fn test_pipe() {
261262 "{} when pipefail is on" ,
262263 case. code_str
263264 ) ;
264- set_pipefail ( false ) ;
265+ let _pipefail = ScopedPipefail :: set ( false ) ;
265266 ok &= check_eq ! (
266267 ( case. code) ( ) ,
267268 case. expected_ok_pipefail_off,
268269 "{} when pipefail is off" ,
269270 case. code_str
270271 ) ;
271- set_pipefail ( true ) ;
272+ let _pipefail = ScopedPipefail :: set ( true ) ;
272273 }
273274
274275 assert ! ( ok) ;
You can’t perform that action at this time.
0 commit comments