src/Comodojo/Daemon/Utils/ProcessTools.php
public static function term($pid, $lagger_timeout = 0, $signal = SIGTERM) {

        $kill_time = time() + $lagger_timeout;

        // $term = posix_kill($pid, $signal);
        $term = self::signal($pid, $signal);

        while ( time() < $kill_time ) {

            if ( !self::isRunning($pid) ) return $term;
            usleep(20000);

        }

        return self::kill($pid);

    }
public static function term($pid, $lagger_timeout = 0, $signal = SIGTERM) {

        $kill_time = time() + $lagger_timeout;

        // $term = posix_kill($pid, $signal);
        $term = self::signal($pid, $signal);

        while ( time() < $kill_time ) {

            if ( !self::isRunning($pid) ) return $term;
            usleep(20000);

        }

        return self::kill($pid);

    }
public static function term ( $ pid , $ lagger_timeout = 0 , $ signal = SIGTERM ) { $ kill_time = time ( ) + $ lagger_timeout ; // $term = posix_kill($pid, $signal); $ term = self :: signal ( $ pid , $ signal ) ; while ( time ( ) < $ kill_time ) { if ( ! self :: isRunning ( $ pid ) ) return $ term ; usleep ( 20000 ) ; } return self :: kill ( $ pid ) ; }
Terminate a process, asking PID to terminate or killing it directly.

@param int $pid
@param int $lagger_timeout Timeout to wait before killing process if it refuses to terminate
@param int $signal Signal to send (default to SIGTERM)

@return  bool
Terminate a process asking PID to terminate or killing it directly .