Code Duplication    Length = 15-15 lines in 2 locations

src/Comodojo/Extender/Components/ProcessUtils.php 1 location

@@ 35-49 (lines=15) @@
32
     * 
33
     * @return  bool
34
     */
35
    public static function kill($pid, $lagger_timeout = 0) {
36
37
        $kill_time = time() + self::$lagger_timeout;
38
39
        $term = posix_kill($pid, SIGTERM);
40
41
        while ( time() < $kill_time ) {
42
            
43
            if ( !self::isRunning($pid) ) return $term;
44
45
        }
46
47
        return posix_kill($pid, SIGKILL);
48
49
    }
50
    
51
    /**
52
     * Return true if process is still running, false otherwise

src/Runner/JobsRunner.php 1 location

@@ 649-663 (lines=15) @@
646
     * 
647
     * @return  bool
648
     */
649
    private static function kill($pid) {
650
651
        $kill_time = time() + self::$lagger_timeout;
652
653
        $term = posix_kill($pid, SIGTERM);
654
655
        while ( time() < $kill_time ) {
656
            
657
            if ( !self::isRunning($pid) ) return $term;
658
659
        }
660
661
        return posix_kill($pid, SIGKILL);
662
663
    }
664
665
    /**
666
     * Get a job unique identifier