Crypt_GPG
[ class tree: Crypt_GPG ] [ index: Crypt_GPG ] [ all elements ]

Class: Crypt_GPG_ProcessControl

Source Location: /Crypt_GPG-1.6.4/Crypt/GPG/ProcessControl.php

Class Overview


A class for monitoring and terminating processes by PID


Author(s):

Copyright:

  • 2013 silverorange

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 50]
A class for monitoring and terminating processes by PID

This is used to safely terminate the gpg-agent for GnuPG 2.x. This class is limited in its abilities and can only check if a PID is running and send a PID SIGTERM.



[ Top ]


Class Variables

$pid =

[line 59]

The PID (process identifier) being monitored
  • Access: protected

Type:   integer


[ Top ]



Method Detail

__construct (Constructor)   [line 69]

Crypt_GPG_ProcessControl __construct( integer $pid)

Creates a new process controller from the given PID (process identifier)
  • Access: public

Parameters:

integer   $pid   —  the PID (process identifier).

[ Top ]

getPid   [line 82]

integer getPid( )

Gets the PID (process identifier) being controlled
  • Return: the PID being controlled.
  • Access: public

[ Top ]

isRunning   [line 99]

boolean isRunning( )

Checks if the process is running

If the posix extension is available, posix_getpgid() is used. Otherwise ps is used on UNIX-like systems and tasklist on Windows.

  • Return: true if the process is running, false if not.
  • Access: public

[ Top ]

terminate   [line 136]

void terminate( )

Ends the process gracefully

The signal SIGTERM is sent to the process. The gpg-agent process will end gracefully upon receiving the SIGTERM signal. Upon 3 consecutive SIGTERM signals the gpg-agent will forcefully shut down.

If the posix extension is available, posix_kill() is used. Otherwise kill is used on UNIX-like systems and taskkill is used in Windows.

  • Access: public

[ Top ]


Documentation generated on Sun, 22 Mar 2020 08:01:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.