Subversion Repositories HelenOS

Rev

Rev 4377 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4377 Rev 4692
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);
121
    free(tmp);
123
    free(tmp);
122
 
124
 
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
    } else {
-
 
127
        return 0;
-
 
128
    }
128
    }
-
 
129
   
-
 
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
 
-
 
137
    return 0;
129
}
138
}