File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 1
1
//! Helpers for interacting with mountpoints
2
2
3
- use std:: process:: Command ;
4
-
5
3
use anyhow:: { anyhow, Context , Result } ;
6
4
use camino:: Utf8Path ;
7
5
use fn_error_context:: context;
@@ -25,16 +23,12 @@ pub(crate) struct Findmnt {
25
23
26
24
#[ context( "Inspecting filesystem {path}" ) ]
27
25
pub ( crate ) fn inspect_filesystem ( path : & Utf8Path ) -> Result < Filesystem > {
28
- tracing :: debug !( "Inspecting {path}" ) ;
29
- let o = Command :: new ( "findmnt" )
26
+ let desc = format ! ( "Inspecting {path}" ) ;
27
+ let o = Task :: new ( & desc , "findmnt" )
30
28
. args ( [ "-J" , "-v" , "--output-all" , path. as_str ( ) ] )
31
- . output ( ) ?;
32
- let st = o. status ;
33
- if !st. success ( ) {
34
- anyhow:: bail!( "findmnt {path} failed: {st:?}" ) ;
35
- }
36
- let o: Findmnt = serde_json:: from_reader ( std:: io:: Cursor :: new ( & o. stdout ) )
37
- . context ( "Parsing findmnt output" ) ?;
29
+ . quiet ( )
30
+ . read ( ) ?;
31
+ let o: Findmnt = serde_json:: from_str ( & o) . context ( "Parsing findmnt output" ) ?;
38
32
o. filesystems
39
33
. into_iter ( )
40
34
. next ( )
You can’t perform that action at this time.
0 commit comments