take_stdout_fd


Description:

public void take_stdout_fd (int fd)

Sets the file descriptor to use as the stdout for spawned processes.

If fd is -1 then any previously given fd is unset.

Note that the default behaviour is to pass stdout through to the stdout of the parent process.

The passed fd is noted but will not be touched in the current process. It is therefore necessary that it be kept open by the caller until the subprocess is spawned. The file descriptor will also not be explicitly closed on the child side, so it must be marked O_CLOEXEC if that's what you want.

You may not set a stdout fd if a stdout file path is already set or if the launcher flags contain any flags directing stdout elsewhere.

This feature is only available on UNIX.

Parameters:

this

a SubprocessLauncher

fd

a file descriptor, or -1