1// Copyright 2018 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#include <lib/fdio/spawn.h>
6#include <stdio.h>
7
8int main(int argc, char** argv) {
9    char err_msg[FDIO_SPAWN_ERR_MSG_MAX_LENGTH];
10    zx_status_t status = fdio_spawn_etc(
11        ZX_HANDLE_INVALID,
12        FDIO_SPAWN_CLONE_ALL,
13        argv[1],
14        (const char* const*)argv + 1,
15        NULL,
16        0,
17        NULL,
18        NULL,
19        err_msg);
20
21    if (status != ZX_OK)
22        fprintf(stderr, "error: fdio_spawn: %s\n", err_msg);
23
24    return status;
25}
26