@@ -6,11 +6,7 @@ use crate::action::{
66 } ,
77 Action , ActionDescription , ActionError , ActionErrorKind , ActionTag , StatefulAction ,
88} ;
9- use std:: {
10- path:: { Path , PathBuf } ,
11- time:: Duration ,
12- } ;
13- use tokio:: process:: Command ;
9+ use std:: path:: { Path , PathBuf } ;
1410use tracing:: { span, Span } ;
1511
1612use super :: {
@@ -179,30 +175,7 @@ impl Action for CreateNixVolume {
179175 . await
180176 . map_err ( Self :: error) ?;
181177
182- let mut retry_tokens: usize = 50 ;
183- loop {
184- let mut command = Command :: new ( "/usr/sbin/diskutil" ) ;
185- command. args ( [ "info" , "-plist" ] ) ;
186- command. arg ( & self . volume_label ) ;
187- command. stderr ( std:: process:: Stdio :: null ( ) ) ;
188- command. stdout ( std:: process:: Stdio :: null ( ) ) ;
189- tracing:: trace!( %retry_tokens, command = ?command. as_std( ) , "Checking for Nix Store volume existence" ) ;
190- let output = command
191- . output ( )
192- . await
193- . map_err ( |e| ActionErrorKind :: command ( & command, e) )
194- . map_err ( Self :: error) ?;
195- if output. status . success ( ) {
196- break ;
197- } else if retry_tokens == 0 {
198- return Err ( Self :: error ( ActionErrorKind :: command_output (
199- & command, output,
200- ) ) ) ;
201- } else {
202- retry_tokens = retry_tokens. saturating_sub ( 1 ) ;
203- }
204- tokio:: time:: sleep ( Duration :: from_millis ( 100 ) ) . await ;
205- }
178+ super :: wait_for_nix_store_dir ( ) . await . map_err ( Self :: error) ?;
206179
207180 self . create_fstab_entry
208181 . try_execute ( )
0 commit comments