fix(control): add error handler for shutdown

closes: #53
This commit is contained in:
E44
2026-06-14 19:09:20 +02:00
parent 5ecf2da8a9
commit 2dcf5a7758
2 changed files with 13 additions and 8 deletions
+6 -2
View File
@@ -325,8 +325,12 @@ async function run_shell_command(ip: string, command: string): Promise<RequestRe
return await request_display(ip, '/shellCommand', options);
}
export async function shutdown(ip: string): Promise<RequestResponse> {
return await run_shell_command(ip, 'xfce4-session-logout --halt');
export async function shutdown(ip: string): Promise<boolean> {
const command = 'xfce4-session-logout --halt';
const raw_response = await run_shell_command(ip, command);
if (!raw_response.ok) return false;
if (handle_shell_error(ip, raw_response, command, true)) return false;
return true;
}
export async function startup(mac: string): Promise<RequestResponse> {