diff options
Diffstat (limited to 'src/user/knob/task.c')
-rw-r--r-- | src/user/knob/task.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/user/knob/task.c b/src/user/knob/task.c index 3bf3e85..9a49386 100644 --- a/src/user/knob/task.c +++ b/src/user/knob/task.c @@ -1,9 +1,12 @@ -#include <stdbool.h> #include <pland/syscall.h> #include <knob/file.h> #include <knob/heap.h> #include <knob/block.h> +#include <stdbool.h> + +#include <knob/format.h> + _task_handle_t run_command(const char *path, _task_handle_t stdio_task) { uint8_t dn; path = remove_prefix(path, &dn); @@ -14,9 +17,9 @@ _task_handle_t run_command(const char *path, _task_handle_t stdio_task) { blockcpy(new_path, path, ptr - path); new_path[ptr - path] = '\0'; - bool succeded = _start_task(dn, new_path, ptr + 1, stdio_task); + _task_handle_t handle = _start_task(dn, new_path, ptr + 1, stdio_task); free_block(new_path); - return succeded; + return handle; } return _start_task(dn, path, "", stdio_task); @@ -24,11 +27,12 @@ _task_handle_t run_command(const char *path, _task_handle_t stdio_task) { bool try_run_command_blocking(const char *path, _task_handle_t stdio_task) { _task_handle_t handle = run_command(path, stdio_task); - if (!handle) + if (!handle) { return false; - while (_is_task_running(handle)) { + } + do { _wait_for_task(handle); _yield_task(); - } + } while (_is_task_running(handle)); return true; }
\ No newline at end of file |