# Poco

# class ProcessHandle

Library: Foundation
Package: Processes
Header: Poco/Process.h

## Description

A handle for a process created with Process::launch().

This handle can be used to determine the process ID of the newly created process and it can be used to wait for the completion of a process.

## Member Summary

Member Functions: id, operator =, tryWait, wait

## Types Aliases

### PID

using PID = ProcessImpl::PIDImpl;

## Constructors

### ProcessHandle

ProcessHandle(
const ProcessHandle & handle
);

Creates a ProcessHandle by copying another one.

### ProcessHandle

ProcessHandle(
ProcessHandleImpl * pImpl
);

## Destructor

### ~ProcessHandle

~ProcessHandle();

Destroys the ProcessHandle.

## Member Functions

### id

PID id() const;

Returns the process ID.

### operator =

ProcessHandle & operator = (
const ProcessHandle & handle
);

Assigns another handle.

### tryWait

int tryWait() const;

Checks that process is terminated and returns the exit code of the process. If the process is still running, returns -1.

### wait

int wait() const;

Waits for the process to terminate and returns the exit code of the process.