File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,11 @@ pub(crate) fn wipefs(dev: &Utf8Path) -> Result<()> {
92
92
)
93
93
}
94
94
95
- fn list_impl ( dev : Option < & Utf8Path > ) -> Result < Vec < Device > > {
95
+ #[ context( "Listing device {dev}" ) ]
96
+ pub ( crate ) fn list_dev ( dev : & Utf8Path ) -> Result < Device > {
96
97
let o = Command :: new ( "lsblk" )
97
98
. args ( [ "-J" , "-b" , "-O" ] )
98
- . args ( dev)
99
+ . arg ( dev)
99
100
. output ( ) ?;
100
101
if !o. status . success ( ) {
101
102
return Err ( anyhow:: anyhow!( "Failed to list block devices" ) ) ;
@@ -104,13 +105,7 @@ fn list_impl(dev: Option<&Utf8Path>) -> Result<Vec<Device>> {
104
105
for dev in devs. blockdevices . iter_mut ( ) {
105
106
dev. backfill_missing ( ) ?;
106
107
}
107
- Ok ( devs. blockdevices )
108
- }
109
-
110
- #[ context( "Listing device {dev}" ) ]
111
- pub ( crate ) fn list_dev ( dev : & Utf8Path ) -> Result < Device > {
112
- let devices = list_impl ( Some ( dev) ) ?;
113
- devices
108
+ devs. blockdevices
114
109
. into_iter ( )
115
110
. next ( )
116
111
. ok_or_else ( || anyhow ! ( "no device output from lsblk for {dev}" ) )
You can’t perform that action at this time.
0 commit comments