@@ -136,7 +136,7 @@ fn wait_for_tcp_listener(pid: u32, log_path: &Path, timeout: Duration) -> bool {
136136 if logs. contains ( "TCP Access Socket created" ) {
137137 return true ;
138138 }
139- if ! std:: fs:: metadata ( format ! ( "/proc/{pid}" ) ) . is_ok ( ) {
139+ if std:: fs:: metadata ( format ! ( "/proc/{pid}" ) ) . is_err ( ) {
140140 panic ! ( "auraed pid {pid} exited early. logs:\n {}" , logs) ;
141141 }
142142 thread:: sleep ( Duration :: from_millis ( 50 ) ) ;
@@ -150,10 +150,10 @@ fn wait_for_pid_file(dir: &Path, timeout: Duration) -> u32 {
150150 let pidfile = dir. join ( "runtime" ) . join ( "auraed.pid" ) ;
151151 let start = Instant :: now ( ) ;
152152 while start. elapsed ( ) < timeout {
153- if let Ok ( contents) = std:: fs:: read_to_string ( & pidfile) {
154- if let Ok ( pid) = contents. trim ( ) . parse :: < u32 > ( ) {
155- return pid ;
156- }
153+ if let Ok ( contents) = std:: fs:: read_to_string ( & pidfile)
154+ && let Ok ( pid) = contents. trim ( ) . parse :: < u32 > ( )
155+ {
156+ return pid ;
157157 }
158158 thread:: sleep ( Duration :: from_millis ( 50 ) ) ;
159159 }
@@ -167,15 +167,13 @@ fn assert_ns_pid1(pid: u32) {
167167 if status. is_empty ( ) {
168168 panic ! ( "status file {status_path} empty or missing" ) ;
169169 }
170- if ! std:: fs:: metadata ( format ! ( "/proc/{pid}" ) ) . is_ok ( ) {
170+ if std:: fs:: metadata ( format ! ( "/proc/{pid}" ) ) . is_err ( ) {
171171 panic ! ( "process {pid} not alive" ) ;
172172 }
173- if let Some ( ns_line) = status. lines ( ) . find ( |l| l. starts_with ( "NSpid:" ) ) {
174- if ns_line. split_whitespace ( ) . last ( ) != Some ( "1" ) {
175- panic ! (
176- "expected auraed to be pid 1 in its namespace, got {ns_line}"
177- ) ;
178- }
173+ if let Some ( ns_line) = status. lines ( ) . find ( |l| l. starts_with ( "NSpid:" ) )
174+ && ns_line. split_whitespace ( ) . last ( ) != Some ( "1" )
175+ {
176+ panic ! ( "expected auraed to be pid 1 in its namespace, got {ns_line}" ) ;
179177 }
180178 // If NSpid missing, we accept the process as long as it is alive; some kernels omit NSpid.
181179}
0 commit comments