fix: __check-config runs quietly without a home directory
This commit is contained in:
1 parent
c97dd018b6
commit
d298a3c3c7
2 files changed
+16
No files matched your search
@@ -67,6 +67,11 @@
|
|||||||
pkgs.runCommand "valw-home-module" { } ''
|
pkgs.runCommand "valw-home-module" { } ''
|
||||||
grep -qx 'timeout_secs = 3' ${set.xdg.configFile."valw/config.toml".source}
|
grep -qx 'timeout_secs = 3' ${set.xdg.configFile."valw/config.toml".source}
|
||||||
grep -qx 'volume = 0.4' ${set.xdg.configFile."valw/config.toml".source}
|
grep -qx 'volume = 0.4' ${set.xdg.configFile."valw/config.toml".source}
|
||||||
|
# Quiet, and no home directory needed.
|
||||||
|
HOME=/nonexistent ${valw}/bin/valw __check-config ${
|
||||||
|
set.xdg.configFile."valw/config.toml".source
|
||||||
|
} 2> err
|
||||||
|
test ! -s err
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|||||||
+11
@@ -160,6 +160,16 @@ enum Mode {
|
|||||||
|
|
||||||
fn main() -> ExitCode {
|
fn main() -> ExitCode {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
// home-manager runs this in the build sandbox: no home, no logs, quiet.
|
||||||
|
if let Command::CheckConfig { file } = &cli.command {
|
||||||
|
return match config::check(file) {
|
||||||
|
Ok(()) => ExitCode::SUCCESS,
|
||||||
|
Err(e) => {
|
||||||
|
eprint!("{}", error::render(&e, None));
|
||||||
|
ExitCode::FAILURE
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
let log = log::init(&log::default_dir(), Local::now());
|
let log = log::init(&log::default_dir(), Local::now());
|
||||||
log::install_panic_hook(log.clone());
|
log::install_panic_hook(log.clone());
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
@@ -191,6 +201,7 @@ fn run(cli: Cli) -> Result<()> {
|
|||||||
Command::Window { common } => capture(Mode::Window, common),
|
Command::Window { common } => capture(Mode::Window, common),
|
||||||
Command::Zoom { common } => capture(Mode::Zoom, common),
|
Command::Zoom { common } => capture(Mode::Zoom, common),
|
||||||
Command::Edit { file } => editor::run(&file),
|
Command::Edit { file } => editor::run(&file),
|
||||||
|
// Handled in main, before logging starts.
|
||||||
Command::CheckConfig { file } => config::check(&file),
|
Command::CheckConfig { file } => config::check(&file),
|
||||||
Command::ComboDemo => sound::demo(&config::load(&config::default_path())?.sound),
|
Command::ComboDemo => sound::demo(&config::load(&config::default_path())?.sound),
|
||||||
Command::Toolbar => {
|
Command::Toolbar => {
|
||||||
|
|||||||
Reference in new issue
Block a user