Ignore:
File:
1 edited

Legend:

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

    radb49f58 r7e752b2  
    3838#include <stdlib.h>
    3939#include <unistd.h>
    40 #include <string.h>
     40#include <str.h>
    4141#include <fcntl.h>
     42#include <str_error.h>
     43#include <errno.h>
    4244
    4345#include "config.h"
     
    115117        task_exit_t texit;
    116118        char *tmp;
    117         int retval;
     119        int rc, retval;
    118120
    119121        tmp = str_dup(find_command(cmd));
    120122        free(found);
    121123
    122         tid = task_spawn((const char *)tmp, argv);
     124        rc = task_spawnv(&tid, tmp, (const char **) argv);
    123125        free(tmp);
    124126
    125         if (tid == 0) {
    126                 cli_error(CL_EEXEC, "Cannot spawn `%s'.", cmd);
     127        if (rc != 0) {
     128                cli_error(CL_EEXEC, "%s: Cannot spawn `%s' (%s)", progname, cmd,
     129                    str_error(rc));
    127130                return 1;
    128131        }
    129132       
    130         task_wait(tid, &texit, &retval);
    131         if (texit != TASK_EXIT_NORMAL) {
    132                 printf("Command failed (unexpectedly terminated).\n");
     133        rc = task_wait(tid, &texit, &retval);
     134        if (rc != EOK) {
     135                printf("%s: Failed waiting for command (%s)\n", progname,
     136                    str_error(rc));
     137        } else if (texit != TASK_EXIT_NORMAL) {
     138                printf("%s: Command failed (unexpectedly terminated)\n", progname);
    133139        } else if (retval != 0) {
    134                 printf("Command failed (return value %d).\n", retval);
     140                printf("%s: Command failed (exit code %d)\n",
     141                    progname, retval);
    135142        }
    136143
Note: See TracChangeset for help on using the changeset viewer.