spawn_with_fds_async


Description:

[ Version ( since = "0.62" ) ]
public async void spawn_with_fds_async (string? working_directory, string[] argv, string[]? envv, int[]? fds, int[]? map_fds, SpawnFlags spawn_flags, owned SpawnChildSetupFunc? child_setup, int timeout, Cancellable? cancellable)

Starts the specified command under the pseudo-terminal this.

The argv and envv lists should be null-terminated. The "TERM" environment variable is automatically set to a default value, but can be overridden from envv. pty_flags controls logging the session to the specified system log files.

Note also that STDOUT_TO_DEV_NULL, STDERR_TO_DEV_NULL, and CHILD_INHERITS_STDIN are not supported in spawn_flags , since stdin, stdout and stderr of the child process will always be connected to the PTY. Also LEAVE_DESCRIPTORS_OPEN is not supported; and DO_NOT_REAP_CHILD will always be added to spawn_flags .

If fds is not null, the child process will map the file descriptors from fds according to map_fds ; map_fds.length must be less or equal to fds.length. This function will take ownership of the file descriptors in fds; you must not use or close them after this call. All file descriptors in fds must have the FD_CLOEXEC flag set on them; it will be unset in the child process before calling man:execve(2). Note also that no file descriptor may be mapped to stdin, stdout, or stderr (file descriptors 0, 1, or 2), since these will be assigned to the PTY. All open file descriptors apart from those mapped as above will be closed when execve is called.

Beginning with 0.60, and on linux only, and unless SPAWN_NO_SYSTEMD_SCOPE is passed in spawn_flags, the newly created child process will be moved to its own systemd user scope; and if SPAWN_REQUIRE_SYSTEMD_SCOPE is passed, and creation of the systemd user scope fails, the whole spawn will fail. You can override the options used for the systemd user scope by providing a systemd override file for 'vte-spawn-.scope' unit. See man:systemd.unit(5) for further information.

See Pty, and watch_child for more information.

Parameters:

this

a Pty

working_directory

the name of a directory the command should start in, or null to use the current working directory

argv

child's argument vector

envv

a list of environment variables to be added to the environment before starting the process, or null

fds

an array of file descriptors, or null

map_fds

an array of integers, or null

spawn_flags

flags from SpawnFlags

child_setup

an extra child setup function to run in the child just before exec, or null

timeout

a timeout value in ms, -1 for the default timeout, or G_MAXINT to wait indefinitely

cancellable

a Cancellable, or null

callback

a TaskReadyCallback, or null

child_setup_data

user data for child_setup, or null

child_setup_data_destroy

a DestroyNotify for child_setup_data, or null

n_fds

the number of file descriptors in fds, or 0 if fds is null

n_map_fds

the number of elements in map_fds, or 0 if map_fds is null

user_data

user data for callback