From 143156f63e2448733f1a35a74e629fe0ae9bb567 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 13 Sep 2020 19:51:09 -0400 Subject: have command shell block while commands are running --- src/user/knob/task.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/user/knob') diff --git a/src/user/knob/task.c b/src/user/knob/task.c index 598bee2..df5d38f 100644 --- a/src/user/knob/task.c +++ b/src/user/knob/task.c @@ -4,7 +4,7 @@ #include #include -bool try_run_command(const char *path) { +_task_handle_t run_command(const char *path) { uint8_t dn; path = remove_prefix(path, &dn); @@ -22,6 +22,15 @@ bool try_run_command(const char *path) { return _start_task(dn, path, ""); } +bool try_run_command_blocking(const char *path) { + _task_handle_t handle = run_command(path); + if (!handle) + return false; + _wait_for_task(handle); + _yield_task(); + return true; +} + void yield_task() { _yield_task(); } \ No newline at end of file -- cgit v1.2.3