File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use fn_error_context::context;
10
10
use regex:: Regex ;
11
11
use serde:: Deserialize ;
12
12
13
+ use crate :: cmdutils:: CommandRunExt ;
13
14
use crate :: install:: run_in_host_mountns;
14
15
use crate :: task:: Task ;
15
16
@@ -94,14 +95,10 @@ pub(crate) fn wipefs(dev: &Utf8Path) -> Result<()> {
94
95
95
96
#[ context( "Listing device {dev}" ) ]
96
97
pub ( crate ) fn list_dev ( dev : & Utf8Path ) -> Result < Device > {
97
- let o = Command :: new ( "lsblk" )
98
+ let mut devs : DevicesOutput = Command :: new ( "lsblk" )
98
99
. args ( [ "-J" , "-b" , "-O" ] )
99
100
. arg ( dev)
100
- . output ( ) ?;
101
- if !o. status . success ( ) {
102
- return Err ( anyhow:: anyhow!( "Failed to list block devices" ) ) ;
103
- }
104
- let mut devs: DevicesOutput = serde_json:: from_reader ( & * o. stdout ) ?;
101
+ . run_and_parse_json ( ) ?;
105
102
for dev in devs. blockdevices . iter_mut ( ) {
106
103
dev. backfill_missing ( ) ?;
107
104
}
You can’t perform that action at this time.
0 commit comments