Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/exec.c

    rd9fae235 r0485135  
    4141#include <fcntl.h>
    4242#include <str_error.h>
     43#include <errno.h>
    4344
    4445#include "config.h"
     
    116117        task_exit_t texit;
    117118        char *tmp;
    118         int retval;
     119        int rc, retval;
    119120
    120121        tmp = str_dup(find_command(cmd));
    121122        free(found);
    122123
    123         tid = task_spawn(tmp, (const char **) argv, &retval);
     124        rc = task_spawnv(&tid, tmp, (const char **) argv);
    124125        free(tmp);
    125126
    126         if (tid == 0) {
     127        if (rc != 0) {
    127128                cli_error(CL_EEXEC, "%s: Cannot spawn `%s' (%s)", progname, cmd,
    128                     str_error(retval));
     129                    str_error(rc));
    129130                return 1;
    130131        }
    131132       
    132         task_wait(tid, &texit, &retval);
    133         if (texit != TASK_EXIT_NORMAL) {
     133        rc = task_wait(tid, &texit, &retval);
     134        if (rc != EOK) {
     135                printf("%s: Failed waiting for command (%s)\n", str_error(rc));
     136        } else if (texit != TASK_EXIT_NORMAL) {
    134137                printf("%s: Command failed (unexpectedly terminated)\n", progname);
    135138        } else if (retval != 0) {
    136                 printf("%s: Command failed (%s)\n",
    137                     progname, str_error(retval));
     139                printf("%s: Command failed (exit code %d)\n",
     140                    progname, retval);
    138141        }
    139142
Note: See TracChangeset for help on using the changeset viewer.