//
// Syd: rock-solid unikernel
// src/syd-check.rs: View syd logs using journalctl.
//
// Copyright (c) 2024 Ali Polatel <alip@chesswob.org>
//
// SPDX-License-Identifier: GPL-3.0-or-later

use std::{
    os::unix::process::CommandExt,
    process::{Command, ExitCode},
};

use syd::err::SydResult;

// Set global allocator to mimalloc.
#[global_allocator]
static GLOBAL: mimalloc2_rust::GlobalMiMalloc = mimalloc2_rust::GlobalMiMalloc;

fn main() -> SydResult<ExitCode> {
    syd::set_sigpipe_dfl()?;

    // Configure mimalloc.
    syd::configure_mimalloc();

    Command::new("journalctl")
        .arg("SYSLOG_IDENTIFIER=syd")
        .exec();
    Ok(ExitCode::FAILURE)
}
