fix(crash): ensure ZELLIJ_TMP_DIR exists when starting plugins (#1256)

This commit is contained in:
Thomas Linford 2022-03-23 09:20:46 +01:00 committed by GitHub
parent e7447fe88f
commit c4d62f8f61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -264,6 +264,15 @@ fn start_plugin(
)
});
// ensure tmp dir exists, in case it somehow was deleted (e.g systemd-tmpfiles)
fs::create_dir_all(ZELLIJ_TMP_DIR.as_path()).unwrap_or_else(|e| {
log::error!(
"Could not create ZELLIJ_TMP_DIR at {:?} \n Error: {:?}",
&ZELLIJ_TMP_DIR.as_path(),
e
)
});
let mut wasi_env = WasiState::new("Zellij")
.env("CLICOLOR_FORCE", "1")
.map_dir("/host", ".")