From 40cf68a22a1307563c5840a81e81cff9b32b1f3a Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 26 Feb 2023 02:57:27 +0200 Subject: [PATCH] Kernel: Shell now sleeps through Scheduler and doesn't 'hlt' ls doesn't crash when trying to list file --- kernel/kernel/Shell.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/kernel/Shell.cpp b/kernel/kernel/Shell.cpp index dd7eb84a..800285dd 100644 --- a/kernel/kernel/Shell.cpp +++ b/kernel/kernel/Shell.cpp @@ -59,7 +59,7 @@ namespace Kernel TTY_PRINT("{}", m_prompt); for (;;) { - asm volatile("hlt"); + Scheduler::get().set_current_thread_sleeping(); Input::update(); } } @@ -273,7 +273,9 @@ argument_done: if (directory_or_error.is_error()) return TTY_PRINTLN("{}", directory_or_error.error()); auto directory = directory_or_error.release_value(); - ASSERT(directory->ifdir()); + + if (!directory->ifdir()) + return TTY_PRINTLN("Given path does not point to a directory"); auto inodes_or_error = directory->directory_inodes(); if (inodes_or_error.is_error())