summaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2022-03-17 11:57:38 +0100
committerGitHub <noreply@github.com>2022-03-17 11:57:38 +0100
commit092926c5d898b0ca9f4aaabcdccdc8ca3cb0a9c7 (patch)
tree3389781f8e393b32e7573193484bdd77905b36f2 /zellij-server
parent19b74e073a9a408581f46b7e9b042fff177920bd (diff)
fix(wasm_vm): use `cache_dirs` for ephemeral plugin data (#1230)
fix(wasm_vm): use `cache_dirs` for ephemeral plugin data Use proper `cache_directories` by default, that users can be expected to have proper write permissions for. The directory is used for plugin hashes, and compilation data.
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/wasm_vm.rs26
1 files changed, 5 insertions, 21 deletions
diff --git a/zellij-server/src/wasm_vm.rs b/zellij-server/src/wasm_vm.rs
index 4e29d323c..cc00aca98 100644
--- a/zellij-server/src/wasm_vm.rs
+++ b/zellij-server/src/wasm_vm.rs
@@ -29,7 +29,7 @@ use crate::{
};
use zellij_utils::{
- consts::{VERSION, ZELLIJ_PROJ_DIR, ZELLIJ_TMP_DIR},
+ consts::{VERSION, ZELLIJ_CACHE_DIR, ZELLIJ_PROJ_DIR, ZELLIJ_TMP_DIR},
errors::{ContextType, PluginContext},
};
use zellij_utils::{
@@ -106,14 +106,7 @@ pub(crate) fn wasm_thread_main(
.unwrap_or_else(|| panic!("Plugin {:?} could not be resolved", run));
let (instance, plugin_env) = start_plugin(
- plugin_id,
- client_id,
- &plugin,
- tab_index,
- &bus,
- &store,
- &data_dir,
- &plugin_global_data_dir,
+ plugin_id, client_id, &plugin, tab_index, &bus, &store, &data_dir,
);
let mut main_user_instance = instance.clone();
@@ -204,16 +197,8 @@ pub(crate) fn wasm_thread_main(
// load headless plugins
for plugin in plugins.iter() {
if let PluginType::Headless = plugin.run {
- let (instance, plugin_env) = start_plugin(
- plugin_id,
- client_id,
- plugin,
- 0,
- &bus,
- &store,
- &data_dir,
- &plugin_global_data_dir,
- );
+ let (instance, plugin_env) =
+ start_plugin(plugin_id, client_id, plugin, 0, &bus, &store, &data_dir);
headless_plugins.insert(plugin_id, (instance, plugin_env));
plugin_id += 1;
}
@@ -238,7 +223,6 @@ fn start_plugin(
bus: &Bus<PluginInstruction>,
store: &Store,
data_dir: &Path,
- plugin_global_data_dir: &Path,
) -> (Instance, PluginEnv) {
if plugin._allow_exec_host_cmd {
info!(
@@ -271,7 +255,7 @@ fn start_plugin(
let output = Pipe::new();
let input = Pipe::new();
let stderr = LoggingPipe::new(&plugin.location.to_string(), plugin_id);
- let plugin_own_data_dir = plugin_global_data_dir.join(Url::from(&plugin.location).to_string());
+ let plugin_own_data_dir = ZELLIJ_CACHE_DIR.join(Url::from(&plugin.location).to_string());
fs::create_dir_all(&plugin_own_data_dir).unwrap_or_else(|e| {
log::error!(
"Could not create plugin_own_data_dir in {:?} \n Error: {:?}",