Changeset b40bfac in mainline for uspace/app/bdsh/exec.c


Ignore:
Timestamp:
2010-11-08T07:13:25Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63a1e60
Parents:
d70a463 (diff), 3da12d74 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

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

    rd70a463 rb40bfac  
    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.