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