1// Copyright 2016 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#pragma once
6
7#include <lib/fdio/spawn.h>
8#include <zircon/types.h>
9
10union node;
11
12int process_launch(const char* const* argv, const char* path,
13                   int index, zx_handle_t* process, zx_handle_t job,
14                   zx_status_t* status_out, char err_msg[FDIO_SPAWN_ERR_MSG_MAX_LENGTH]);
15
16zx_status_t process_subshell(union node* n, const char* const* envp,
17                             zx_handle_t* process, zx_handle_t job,
18                             int *fds, char err_msg[FDIO_SPAWN_ERR_MSG_MAX_LENGTH]);
19
20// Waits for the process to terminate and returns the exit code for the process.
21int process_await_termination(zx_handle_t process, zx_handle_t job, bool blocking);
22