45,9 → 45,7 |
#include "exec.h" |
#include "errors.h" |
|
/* TODO: create exec, exev, execve wrappers for task_spawn() */ |
|
/* Easiest way to handle a shared + allocated string */ |
/* FIXME: Just have find_command() return an allocated string */ |
char *found; |
|
/* work-around for access() */ |
103,13 → 101,12 |
} |
} |
|
/* We didn't find it, just give it back as-is. Could be an alias |
* set in the parent shell */ |
/* We didn't find it, just give it back as-is. */ |
free(path_tok); |
return (char *) cmd; |
} |
|
task_id_t try_exec(char *cmd, char **argv) |
unsigned int try_exec(char *cmd, char **argv) |
{ |
task_id_t tid; |
char *tmp; |
117,16 → 114,13 |
tmp = cli_strdup(find_command(cmd)); |
free(found); |
|
/* TODO: put the cwd in front of tmp if tmp[0] != root |
* which fixes relative paths fed to task_spawn */ |
|
tid = task_spawn((const char *)tmp, (const char **)argv); |
free(tmp); |
|
if (tid == 0) |
/* HelenOS does not set errno, so all we can do is report |
* a task ID of 0 as a generic failure. */ |
if (tid == 0) { |
cli_error(CL_EEXEC, "Can not spawn %s", cmd); |
|
return tid; |
return 1; |
} else { |
return 0; |
} |
} |