Method

GioSubprocessLaunchertake_fd

Declaration

void
g_subprocess_launcher_take_fd (
  GSubprocessLauncher* self,
  gint source_fd,
  gint target_fd
)

Description

Transfer an arbitrary file descriptor from parent process to the child. This function takes ownership of the source_fd; it will be closed in the parent when self is freed.

By default, all file descriptors from the parent will be closed. This function allows you to create (for example) a custom pipe() or socketpair() before launching the process, and choose the target descriptor in the child.

An example use case is GNUPG, which has a command line argument --passphrase-fd providing a file descriptor number where it expects the passphrase to be written.

Parameters

source_fd

Type: gint

File descriptor in parent process.

target_fd

Type: gint

Target descriptor for child process.