private static function terminate_proc( $proc ) {
		$status = proc_get_status( $proc );

		$master_pid = $status['pid'];

		$output = `ps -o ppid,pid,command | grep $master_pid`;

		foreach ( explode( PHP_EOL, $output ) as $line ) {
			if ( preg_match( '/^\s*(\d+)\s+(\d+)/', $line, $matches ) ) {
				$parent = $matches[1];
				$child = $matches[2];

				if ( $parent == $master_pid ) {
					if ( ! posix_kill( (int) $child, 9 ) ) {
						throw new RuntimeException( posix_strerror( posix_get_last_error() ) );
					}
				}
			}
		}

		if ( ! posix_kill( (int) $master_pid, 9 ) ) {
			throw new RuntimeException( posix_strerror( posix_get_last_error() ) );
		}
	}
private static function terminate_proc( $proc ) {
		$status = proc_get_status( $proc );

		$master_pid = $status['pid'];

		$output = `ps -o ppid,pid,command | grep $master_pid`;

		foreach ( explode( PHP_EOL, $output ) as $line ) {
			if ( preg_match( '/^\s*(\d+)\s+(\d+)/', $line, $matches ) ) {
				$parent = $matches[1];
				$child = $matches[2];

				if ( $parent == $master_pid ) {
					if ( ! posix_kill( (int) $child, 9 ) ) {
						throw new RuntimeException( posix_strerror( posix_get_last_error() ) );
					}
				}
			}
		}

		if ( ! posix_kill( (int) $master_pid, 9 ) ) {
			throw new RuntimeException( posix_strerror( posix_get_last_error() ) );
		}
	}
private static function terminate_proc ( $ proc ) { $ status = proc_get_status ( $ proc ) ; $ master_pid = $ status [ 'pid' ] ; $ output = `ps -o ppid,pid,command | grep $master_pid` ; foreach ( explode ( PHP_EOL , $ output ) as $ line ) { if ( preg_match ( '/^\s*(\d+)\s+(\d+)/' , $ line , $ matches ) ) { $ parent = $ matches [ 1 ] ; $ child = $ matches [ 2 ] ; if ( $ parent == $ master_pid ) { if ( ! posix_kill ( ( int ) $ child , 9 ) ) { throw new RuntimeException ( posix_strerror ( posix_get_last_error ( ) ) ) ; } } } } if ( ! posix_kill ( ( int ) $ master_pid , 9 ) ) { throw new RuntimeException ( posix_strerror ( posix_get_last_error ( ) ) ) ; } }
Terminate a process and any of its children.
Terminate a process and any of its children .