@@ -417,20 +417,6 @@ func (b *Backend) GCCollect(ctx context.Context, ids []string) error {
417417 return errors .Join (errs ... )
418418}
419419
420- // killOrphanProcess terminates a leftover hypervisor process if the PID
421- // file exists and the process matches the expected binary name.
422- func (b * Backend ) killOrphanProcess (ctx context.Context , runDir string ) {
423- pid , err := utils .ReadPIDFile (b .PIDFilePath (runDir ))
424- if err != nil {
425- return
426- }
427- sockPath := SocketPath (runDir )
428- if ! utils .VerifyProcessCmdline (pid , b .Conf .BinaryName (), sockPath ) {
429- return
430- }
431- _ = utils .TerminateProcess (ctx , pid , b .Conf .BinaryName (), sockPath , b .Conf .TerminateGracePeriod ())
432- }
433-
434420func (b * Backend ) PIDFilePath (runDir string ) string {
435421 return filepath .Join (runDir , b .Conf .PIDFileName ())
436422}
@@ -564,6 +550,20 @@ func (b *Backend) HandleStopResult(ctx context.Context, id, runDir string, runti
564550 return nil
565551}
566552
553+ // killOrphanProcess terminates a leftover hypervisor process if the PID
554+ // file exists and the process matches the expected binary name.
555+ func (b * Backend ) killOrphanProcess (ctx context.Context , runDir string ) {
556+ pid , err := utils .ReadPIDFile (b .PIDFilePath (runDir ))
557+ if err != nil {
558+ return
559+ }
560+ sockPath := SocketPath (runDir )
561+ if ! utils .VerifyProcessCmdline (pid , b .Conf .BinaryName (), sockPath ) {
562+ return
563+ }
564+ _ = utils .TerminateProcess (ctx , pid , b .Conf .BinaryName (), sockPath , b .Conf .TerminateGracePeriod ())
565+ }
566+
567567func SocketPath (runDir string ) string { return filepath .Join (runDir , APISocketName ) }
568568
569569func ConsoleSockPath (runDir string ) string { return filepath .Join (runDir , ConsoleSockName ) }
0 commit comments