take_stdin_fd


Description:

public void take_stdin_fd (int fd)

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

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

Note that if your intention is to have the stdin of the calling process inherited by the child then g_subprocess_flags_stdin_inherit is a better way to go about doing that.

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 stdin fd if a stdin file path is already set or if the launcher flags contain any flags directing stdin elsewhere.

This feature is only available on UNIX.

Parameters:

this

a SubprocessLauncher

fd

a file descriptor, or -1




2022 vala-language.org