Ignore:
File:
1 edited

Legend:

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

    r0485135 rd9fae235  
    4141#include <fcntl.h>
    4242#include <str_error.h>
    43 #include <errno.h>
    4443
    4544#include "config.h"
     
    117116        task_exit_t texit;
    118117        char *tmp;
    119         int rc, retval;
     118        int retval;
    120119
    121120        tmp = str_dup(find_command(cmd));
    122121        free(found);
    123122
    124         rc = task_spawnv(&tid, tmp, (const char **) argv);
     123        tid = task_spawn(tmp, (const char **) argv, &retval);
    125124        free(tmp);
    126125
    127         if (rc != 0) {
     126        if (tid == 0) {
    128127                cli_error(CL_EEXEC, "%s: Cannot spawn `%s' (%s)", progname, cmd,
    129                     str_error(rc));
     128                    str_error(retval));
    130129                return 1;
    131130        }
    132131       
    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) {
     132        task_wait(tid, &texit, &retval);
     133        if (texit != TASK_EXIT_NORMAL) {
    137134                printf("%s: Command failed (unexpectedly terminated)\n", progname);
    138135        } else if (retval != 0) {
    139                 printf("%s: Command failed (exit code %d)\n",
    140                     progname, retval);
     136                printf("%s: Command failed (%s)\n",
     137                    progname, str_error(retval));
    141138        }
    142139
Note: See TracChangeset for help on using the changeset viewer.