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() {
145
145
assert ! ( run_cmd!( false | wc) . is_err( ) ) ;
146
146
assert ! ( run_cmd!( echo xx | false | wc | wc | wc) . is_err( ) ) ;
147
147
148
- set_pipefail ( false ) ;
148
+ let _pipefail = ScopedPipefail :: set ( false ) ;
149
149
assert ! ( run_cmd!( du -ah . | sort -hr | head -n 10 ) . is_ok( ) ) ;
150
- set_pipefail ( true ) ;
150
+ let _pipefail = ScopedPipefail :: set ( true ) ;
151
151
152
152
let wc_cmd = "wc" ;
153
153
assert ! ( run_cmd!( ls | $wc_cmd) . is_ok( ) ) ;
154
+ }
154
155
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 ( ) {
157
158
struct TestCase {
158
159
/// Run the test case, returning whether the result `.is_ok()`.
159
160
code : fn ( ) -> bool ,
@@ -261,14 +262,14 @@ fn test_pipe() {
261
262
"{} when pipefail is on" ,
262
263
case. code_str
263
264
) ;
264
- set_pipefail ( false ) ;
265
+ let _pipefail = ScopedPipefail :: set ( false ) ;
265
266
ok &= check_eq ! (
266
267
( case. code) ( ) ,
267
268
case. expected_ok_pipefail_off,
268
269
"{} when pipefail is off" ,
269
270
case. code_str
270
271
) ;
271
- set_pipefail ( true ) ;
272
+ let _pipefail = ScopedPipefail :: set ( true ) ;
272
273
}
273
274
274
275
assert ! ( ok) ;
You can’t perform that action at this time.
0 commit comments