Reworked the DaemonCommand.
* Accepts options for PID and log file. * Uses posix_kill whenever available. * Checks that the daemon actually started or stopped. * Try to terminate then kill the daemon. * Uses the logger or output instead of "echo". Added a ProcessControl interface and implementations. Closed #908
This commit is contained in:
parent
8fc4c51d54
commit
7de9023810
11 changed files with 572 additions and 45 deletions
33
PHPCI/ProcessControl/ProcessControlInterface.php
Normal file
33
PHPCI/ProcessControl/ProcessControlInterface.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2015, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCI\ProcessControl;
|
||||
|
||||
/**
|
||||
* A stateless service to check and kill system processes.
|
||||
*
|
||||
* @author Adirelle <adirelle@gmail.com>
|
||||
*/
|
||||
interface ProcessControlInterface
|
||||
{
|
||||
/** Checks if a process exists.
|
||||
*
|
||||
* @param int $pid The process identifier.
|
||||
*
|
||||
* @return boolean true is the process is running, else false.
|
||||
*/
|
||||
public function isRunning($pid);
|
||||
|
||||
/** Terminate a running process.
|
||||
*
|
||||
* @param int $pid The process identifier.
|
||||
* @param bool $forcefully Whether to gently (false) or forcefully (true) terminate the process.
|
||||
*/
|
||||
public function kill($pid, $forcefully = false);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue