Function

Shell-18Shellutil_spawn_async_with_pipes_and_fds

  • A wrapper around g_spawn_async_with_pipes_and_fds() with async-signal-safe implementation of GLib.SpawnChildSetupFunc to launch a child program asynchronously resetting the rlimit nofile on child setup.

    Parameters

    • working_directory: string | null

      child's current working directory, or null to inherit parent's, in the GLib file name encoding

    • argv: string[]

      child's argument vector, in the GLib file name encoding; it must be non-empty and null-terminated

    • envp: string[] | null

      child's environment, or null to inherit parent's, in the GLib file name encoding

    • flags: GLib.SpawnFlags

      flags from GLib.SpawnFlags

    • stdin_fd: number

      file descriptor to use for child's stdin, or -1

    • stdout_fd: number

      file descriptor to use for child's stdout, or -1

    • stderr_fd: number

      file descriptor to use for child's stderr, or -1

    • source_fds: number[] | null

      array of FDs from the parent process to make available in the child process

    • target_fds: number[] | null

      array of FDs to remap source_fds to in the child process

    Returns [number, number, number, number]

    the PID of the child on success, 0 if error is set