init: Read config files all at once

This is simpler than streaming and likely a bit faster. Config files are
expected to be tiny.
This commit is contained in:
bjorn3
2025-12-05 20:52:33 +01:00
parent c7adb019b5
commit 1d834c2393
+4 -7
View File
@@ -1,9 +1,9 @@
use std::collections::BTreeMap;
use std::env;
use std::fs::{read_dir, File};
use std::io::{BufRead, BufReader, Result};
use std::fs::read_dir;
use std::io::Result;
use std::path::Path;
use std::process::Command;
use std::{env, fs};
use libredox::flag::{O_RDONLY, O_WRONLY};
@@ -20,10 +20,7 @@ fn switch_stdio(stdio: &str) -> Result<()> {
}
pub fn run(file: &Path) -> Result<()> {
let file = File::open(file)?;
let reader = BufReader::new(file);
for line_res in reader.lines() {
let line_raw = line_res?;
for line_raw in fs::read_to_string(file)?.lines() {
let line = line_raw.trim();
if !line.is_empty() && !line.starts_with('#') {
let mut args = line.split(' ').map(|arg| {