private function _closeSubprocess()
    {
        // clear PINs from environment if they were set
        $_ENV['PINENTRY_USER_DATA'] = null;

        if (is_resource($this->_process)) {
            $this->_debug('CLOSING GPG SUBPROCESS');

            // close remaining open pipes
            foreach (array_keys($this->_openPipes) as $pipeNumber) {
                $this->_closePipe($pipeNumber);
            }

            $status   = proc_get_status($this->_process);
            $exitCode = proc_close($this->_process);

            // proc_close() can return -1 in some cases,
            // get the real exit code from the process status
            if ($exitCode < 0 && $status && !$status['running']) {
                $exitCode = $status['exitcode'];
            }

            if ($exitCode > 0) {
                $this->_debug(
                    '=> subprocess returned an unexpected exit code: ' .
                    $exitCode
                );
            }

            $this->_process = null;
            $this->_pipes   = array();

            // close file handles before throwing an exception
            if (is_resource($this->_input)) {
                fclose($this->_input);
            }

            if (is_resource($this->_output)) {
                fclose($this->_output);
            }

            $this->_processHandler->throwException($exitCode);
        }

        $this->_closeAgentLaunchProcess();

        if ($this->_agentInfo !== null) {
            $parts = explode(':', $this->_agentInfo, 3);

            if (!empty($parts[1])) {
                $this->_debug('STOPPING GPG-AGENT DAEMON');

                $process = new Crypt_GPG_ProcessControl($parts[1]);

                // terminate agent daemon
                $process->terminate();

                while ($process->isRunning()) {
                    usleep(10000); // 10 ms
                    $process->terminate();
                }

                $this->_debug('GPG-AGENT DAEMON STOPPED');
            }

            $this->_agentInfo = null;
        }
    }
private function _closeSubprocess()
    {
        // clear PINs from environment if they were set
        $_ENV['PINENTRY_USER_DATA'] = null;

        if (is_resource($this->_process)) {
            $this->_debug('CLOSING GPG SUBPROCESS');

            // close remaining open pipes
            foreach (array_keys($this->_openPipes) as $pipeNumber) {
                $this->_closePipe($pipeNumber);
            }

            $status   = proc_get_status($this->_process);
            $exitCode = proc_close($this->_process);

            // proc_close() can return -1 in some cases,
            // get the real exit code from the process status
            if ($exitCode < 0 && $status && !$status['running']) {
                $exitCode = $status['exitcode'];
            }

            if ($exitCode > 0) {
                $this->_debug(
                    '=> subprocess returned an unexpected exit code: ' .
                    $exitCode
                );
            }

            $this->_process = null;
            $this->_pipes   = array();

            // close file handles before throwing an exception
            if (is_resource($this->_input)) {
                fclose($this->_input);
            }

            if (is_resource($this->_output)) {
                fclose($this->_output);
            }

            $this->_processHandler->throwException($exitCode);
        }

        $this->_closeAgentLaunchProcess();

        if ($this->_agentInfo !== null) {
            $parts = explode(':', $this->_agentInfo, 3);

            if (!empty($parts[1])) {
                $this->_debug('STOPPING GPG-AGENT DAEMON');

                $process = new Crypt_GPG_ProcessControl($parts[1]);

                // terminate agent daemon
                $process->terminate();

                while ($process->isRunning()) {
                    usleep(10000); // 10 ms
                    $process->terminate();
                }

                $this->_debug('GPG-AGENT DAEMON STOPPED');
            }

            $this->_agentInfo = null;
        }
    }
private function _closeSubprocess ( ) { // clear PINs from environment if they were set $ _ENV [ 'PINENTRY_USER_DATA' ] = null ; if ( is_resource ( $ this -> _process ) ) { $ this -> _debug ( 'CLOSING GPG SUBPROCESS' ) ; // close remaining open pipes foreach ( array_keys ( $ this -> _openPipes ) as $ pipeNumber ) { $ this -> _closePipe ( $ pipeNumber ) ; } $ status = proc_get_status ( $ this -> _process ) ; $ exitCode = proc_close ( $ this -> _process ) ; // proc_close() can return -1 in some cases, // get the real exit code from the process status if ( $ exitCode < 0 && $ status && ! $ status [ 'running' ] ) { $ exitCode = $ status [ 'exitcode' ] ; } if ( $ exitCode > 0 ) { $ this -> _debug ( '=> subprocess returned an unexpected exit code: ' . $ exitCode ) ; } $ this -> _process = null ; $ this -> _pipes = array ( ) ; // close file handles before throwing an exception if ( is_resource ( $ this -> _input ) ) { fclose ( $ this -> _input ) ; } if ( is_resource ( $ this -> _output ) ) { fclose ( $ this -> _output ) ; } $ this -> _processHandler -> throwException ( $ exitCode ) ; } $ this -> _closeAgentLaunchProcess ( ) ; if ( $ this -> _agentInfo !== null ) { $ parts = explode ( ':' , $ this -> _agentInfo , 3 ) ; if ( ! empty ( $ parts [ 1 ] ) ) { $ this -> _debug ( 'STOPPING GPG-AGENT DAEMON' ) ; $ process = new Crypt_GPG_ProcessControl ( $ parts [ 1 ] ) ; // terminate agent daemon $ process -> terminate ( ) ; while ( $ process -> isRunning ( ) ) { usleep ( 10000 ) ; // 10 ms $ process -> terminate ( ) ; } $ this -> _debug ( 'GPG-AGENT DAEMON STOPPED' ) ; } $ this -> _agentInfo = null ; } }
Closes the internal GPG subprocess

Closes the internal GPG subprocess. Sets the private class property
{@link Crypt_GPG_Engine::$_process} to null.

@return void

@see Crypt_GPG_Engine::_openSubprocess()
@see Crypt_GPG_Engine::$_process
Closes the internal GPG subprocess