From c4d62f8f617a2fad50133e1b7829c683429752b4 Mon Sep 17 00:00:00 2001 From: Thomas Linford Date: Wed, 23 Mar 2022 09:20:46 +0100 Subject: [PATCH] fix(crash): ensure ZELLIJ_TMP_DIR exists when starting plugins (#1256) --- zellij-server/src/wasm_vm.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs index cc00aca9..cfd4f760 100644 --- a/zellij-server/src/wasm_vm.rs +++ b/zellij-server/src/wasm_vm.rs @@ -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", ".")