Subversion Repositories HelenOS

Rev

Rev 4581 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4581 Rev 4718
Line 110... Line 110...
110
}
110
}
111
 
111
 
112
unsigned int try_exec(char *cmd, char **argv)
112
unsigned int try_exec(char *cmd, char **argv)
113
{
113
{
114
    task_id_t tid;
114
    task_id_t tid;
-
 
115
    task_exit_t texit;
115
    char *tmp;
116
    char *tmp;
-
 
117
    int retval;
116
 
118
 
117
    tmp = str_dup(find_command(cmd));
119
    tmp = str_dup(find_command(cmd));
118
    free(found);
120
    free(found);
119
 
121
 
120
    tid = task_spawn((const char *)tmp, argv);
122
    tid = task_spawn((const char *)tmp, argv);
Line 123... Line 125...
123
    if (tid == 0) {
125
    if (tid == 0) {
124
        cli_error(CL_EEXEC, "Cannot spawn `%s'.", cmd);
126
        cli_error(CL_EEXEC, "Cannot spawn `%s'.", cmd);
125
        return 1;
127
        return 1;
126
    }
128
    }
127
   
129
   
128
    task_wait(tid);
130
    task_wait(tid, &texit, &retval);
-
 
131
    if (texit != TASK_EXIT_NORMAL) {
-
 
132
        printf("Command failed (unexpectedly terminated).\n");
-
 
133
    } else if (retval != 0) {
-
 
134
        printf("Command failed (return value %d).\n", retval);
-
 
135
    }
-
 
136
 
129
    return 0;
137
    return 0;
130
}
138
}