From b5339aad728abb948dda6cc13d346354311f742c Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Sun, 19 Oct 2025 09:56:10 +0200 Subject: [PATCH 1/9] bump version to next beta --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 42bc7c98..07a057a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -818,7 +818,7 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "sniprun" -version = "1.3.20" +version = "1.3.21-beta" dependencies = [ "backtrace", "close_fds", diff --git a/Cargo.toml b/Cargo.toml index fa875f9c..8619f5c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sniprun" -version = "1.3.20" +version = "1.3.21-beta" authors = ["michaelb "] rust-version = "1.65" edition = "2018" From 4fdeb9c07259c10888888c0eb7cba9801ded8081 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Sun, 19 Oct 2025 09:59:15 +0200 Subject: [PATCH 2/9] fix possible error if user closes manually windows before sniprun proposed by @seleniy in https://github.com/michaelb/sniprun/issues/322 --- lua/sniprun/display.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/sniprun/display.lua b/lua/sniprun/display.lua index e1fbe234..7a6529ea 100644 --- a/lua/sniprun/display.lua +++ b/lua/sniprun/display.lua @@ -136,7 +136,11 @@ function M.fw_close() if M.fw_handle == 0 then return end - vim.api.nvim_win_close(M.fw_handle, true) + -- windows may have been closed by the user, let's not + -- fail with a big lua error just because of that + if vim.api.nvim_win_is_valid(M.fw_handle) then + vim.api.nvim_win_close(M.fw_handle, true) + end M.fw_handle = 0 end From 98f41d27bb9c33ad12d9220309e5523734c4d3d0 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Sun, 19 Oct 2025 10:02:10 +0200 Subject: [PATCH 3/9] fix possible error if users closes terminal window before sniprun --- lua/sniprun/display.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/sniprun/display.lua b/lua/sniprun/display.lua index 7a6529ea..4d9beee7 100644 --- a/lua/sniprun/display.lua +++ b/lua/sniprun/display.lua @@ -154,7 +154,11 @@ function M.term_close() if M.term.window_handle == 0 then return end - vim.api.nvim_win_close(M.term.window_handle, true) + -- windows may have been closed by the user, let's not + -- fail with a big lua error just because of that + if vim.api.nvim_win_is_valid(M.fw_handle) then + vim.api.nvim_win_close(M.term.window_handle, true) + end M.term.window_handle = 0 M.term.buffer = -1 M.term.current_line = 0 From fb5ab81743f22ca2bf5d27677e2036de611f7957 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Tue, 9 Dec 2025 18:36:03 +0100 Subject: [PATCH 4/9] set interpreter/binaries cwd to neovim's cwd --- lua/sniprun.lua | 124 +++++++++++++---------- src/interpreter.rs | 14 +++ src/interpreters/Ada_original.rs | 2 + src/interpreters/Bash_original.rs | 1 + src/interpreters/CS_original.rs | 1 + src/interpreters/CSharp_original.rs | 2 + src/interpreters/C_original.rs | 5 +- src/interpreters/Clojure_fifo.rs | 3 + src/interpreters/Cpp_original.rs | 2 + src/interpreters/D_original.rs | 1 + src/interpreters/Elixir_original.rs | 3 + src/interpreters/FSharp_fifo.rs | 3 + src/interpreters/Generic.rs | 3 + src/interpreters/Go_original.rs | 2 + src/interpreters/Haskell_original.rs | 2 + src/interpreters/JS_TS_bun.rs | 3 + src/interpreters/JS_TS_deno.rs | 3 + src/interpreters/JS_original.rs | 1 + src/interpreters/Java_original.rs | 2 + src/interpreters/Julia_jupyter.rs | 2 + src/interpreters/Julia_original.rs | 3 + src/interpreters/Lua_nvim.rs | 1 + src/interpreters/Lua_original.rs | 1 + src/interpreters/Mathematica_original.rs | 9 ++ src/interpreters/OCaml_fifo.rs | 3 + src/interpreters/PHP_original.rs | 3 + src/interpreters/Plantuml_original.rs | 1 + src/interpreters/Python3_fifo.rs | 2 + src/interpreters/Python3_jupyter.rs | 3 + src/interpreters/Python3_original.rs | 1 + src/interpreters/R_original.rs | 1 + src/interpreters/Ruby_original.rs | 1 + src/interpreters/Rust_original.rs | 4 + src/interpreters/SQL_original.rs | 2 +- src/interpreters/Sage_fifo.rs | 1 + src/interpreters/Scala_original.rs | 2 + src/interpreters/Swift_original.rs | 9 +- src/interpreters/TypeScript_original.rs | 1 + src/lib.rs | 23 +++++ 39 files changed, 194 insertions(+), 56 deletions(-) diff --git a/lua/sniprun.lua b/lua/sniprun.lua index 49be4425..2c5d4608 100644 --- a/lua/sniprun.lua +++ b/lua/sniprun.lua @@ -3,14 +3,11 @@ M.ping_anwsered = 0 M.info_floatwin = {} -- See https://github.com/tjdevries/rofl.nvim/blob/632c10f2ec7c56882a3f7eda8849904bcac6e8af/lua/rofl.lua -local binary_path = vim.fn.fnamemodify( - vim.api.nvim_get_runtime_file("lua/sniprun.lua", false)[1], ":h:h") +local binary_path = vim.fn.fnamemodify(vim.api.nvim_get_runtime_file("lua/sniprun.lua", false)[1], ":h:h") .. "/target/release/sniprun" local sniprun_path = vim.fn.fnamemodify(vim.api.nvim_get_runtime_file("lua/sniprun.lua", false)[1], ":p:h") .. "/.." - - -- default config M.config_values = { selected_interpreters = {}, @@ -19,6 +16,8 @@ M.config_values = { interpreter_options = {}, + cwd = ".", + display = { "Classic", "VirtualTextOk", @@ -35,13 +34,13 @@ M.config_values = { display_options = { terminal_scrollback = vim.o.scrollback, -- change terminal display scrollback lines - terminal_line_number = false, -- whether show line number in terminal window - terminal_signcolumn = false, -- whether show signcolumn in terminal window - terminal_position = "vertical", -- or "horizontal" - terminal_width = 45, -- change the terminal display option width (if vertical) - terminal_height = 20, -- change the terminal display option heigth (if horizontal) - notification_timeout = 5, -- timeout for nvim_notify output - notification_render = "default" -- nvim_notify style + terminal_line_number = false, -- whether show line number in terminal window + terminal_signcolumn = false, -- whether show signcolumn in terminal window + terminal_position = "vertical", -- or "horizontal" + terminal_width = 45, -- change the terminal display option width (if vertical) + terminal_height = 20, -- change the terminal display option heigth (if horizontal) + notification_timeout = 5, -- timeout for nvim_notify output + notification_render = "default", -- nvim_notify style }, show_no_output = { @@ -51,19 +50,25 @@ M.config_values = { ansi_escape = true, inline_messages = 0, - borders = 'single', + borders = "single", -- default highlight stuff goes here snipruncolors = { - SniprunVirtualTextOk = { default = true, bg = "#66eeff", fg = "#000000", ctermbg = "Cyan", ctermfg = "Black" }, - SniprunFloatingWinOk = { default = true, fg = "#66eeff", ctermfg = "Cyan" }, - SniprunVirtualTextErr = { default = true, bg = "#881515", fg = "#000000", ctermbg = "DarkRed", ctermfg = "Black" }, + SniprunVirtualTextOk = { default = true, bg = "#66eeff", fg = "#000000", ctermbg = "Cyan", ctermfg = "Black" }, + SniprunFloatingWinOk = { default = true, fg = "#66eeff", ctermfg = "Cyan" }, + SniprunVirtualTextErr = { + default = true, + bg = "#881515", + fg = "#000000", + ctermbg = "DarkRed", + ctermfg = "Black", + }, SniprunFloatingWinErr = { default = true, fg = "#881515", ctermfg = "DarkRed" }, }, -- whether the user can toggle the live_mode. It's kept as an option so it's not activated by chance -- by an user that would be unaware of the potentially dangerous behavior - live_mode_toggle = 'off', + live_mode_toggle = "off", -- auto-filled with the real nvim's PID, sniprun's bin and source locations neovim_pid = 0, @@ -71,12 +76,12 @@ M.config_values = { sniprun_path = sniprun_path, } - M.config_up = 0 - function M.initial_setup() - if M.config_up == 1 then return end + if M.config_up == 1 then + return + end M.setup() M.config_up = 0 end @@ -87,11 +92,11 @@ function M.setup(opts) -- pre-process config keys for key, value in pairs(opts) do if M.config_values[key] == nil then - error(string.format('[Sniprun] Key %s does not exist in config values', key)) + error(string.format("[Sniprun] Key %s does not exist in config values", key)) return end - if key == 'live_mode_toggle' and opts[key] == 'enable' then - require('sniprun.live_mode') + if key == "live_mode_toggle" and opts[key] == "enable" then + require("sniprun.live_mode") end end @@ -111,7 +116,7 @@ function M.setup(opts) M.config_up = 1 end -local highlight = function (group, styles) +local highlight = function(group, styles) -- Maintain compatibility with the previous way of setting highlights. local attrs = {} if styles.gui then @@ -123,9 +128,8 @@ local highlight = function (group, styles) vim.api.nvim_set_hl(0, group, vim.tbl_extend("force", attrs, styles)) end - function M.setup_display() - local D = require 'sniprun.display' + local D = require("sniprun.display") D.borders = M.config_values.borders end @@ -163,7 +167,12 @@ function M.configure_keymaps() vim.api.nvim_set_keymap("n", "SnipRunOperator", ":set opfunc=SnipRunOperatorg@", { silent = true }) vim.api.nvim_set_keymap("n", "SnipReset", ":lua require'sniprun'.reset()", { silent = true }) vim.api.nvim_set_keymap("n", "SnipInfo", ":lua require'sniprun'.info()", {}) - vim.api.nvim_set_keymap("n", "SnipReplMemoryClean", ":lua require'sniprun'.clear_repl()", { silent = true }) + vim.api.nvim_set_keymap( + "n", + "SnipReplMemoryClean", + ":lua require'sniprun'.clear_repl()", + { silent = true } + ) vim.api.nvim_set_keymap("n", "SnipClose", ":lua require'sniprun.display'.close_all()", { silent = true }) vim.cmd("command! SnipReset :lua require'sniprun'.reset()") @@ -171,18 +180,23 @@ function M.configure_keymaps() vim.cmd("function! SnipRunOperator(...) \n lua require'sniprun'.run('n') \n endfunction") vim.cmd("command! SnipClose :lua require'sniprun.display'.close_all()") - vim.cmd("function! ListInterpreters(A,L,P) \n let l = split(globpath('" .. - M.config_values.sniprun_path .. - "/doc/sources/interpreters', '*.md'),'\\n') \n let rl = [] \n for e in l \n let rl += [split(e,'/')[-1][:-4]] \n endfor \n return rl \n endfunction") + vim.cmd( + "function! ListInterpreters(A,L,P) \n let l = split(globpath('" + .. M.config_values.sniprun_path + .. "/doc/sources/interpreters', '*.md'),'\\n') \n let rl = [] \n for e in l \n let rl += [split(e,'/')[-1][:-4]] \n endfor \n return rl \n endfunction" + ) vim.cmd("command! -nargs=* -complete=customlist,ListInterpreters SnipInfo :lua require'sniprun'.info()") vim.cmd( - "function! SnipRunLauncher(...) range \nif a:firstline == a:lastline \n lua require'sniprun'.run() \n elseif a:firstline == 1 && a:lastline == line(\"$\")\nlet g:sniprun_cli_args_list = a:000\n let g:sniprun_cli_args = join(g:sniprun_cli_args_list,\" \") \n lua require'sniprun'.run('w') \n else \n lua require'sniprun'.run('v') \n endif \n endfunction") + "function! SnipRunLauncher(...) range \nif a:firstline == a:lastline \n lua require'sniprun'.run() \n elseif a:firstline == 1 && a:lastline == line(\"$\")\nlet g:sniprun_cli_args_list = a:000\n let g:sniprun_cli_args = join(g:sniprun_cli_args_list,\" \") \n lua require'sniprun'.run('w') \n else \n lua require'sniprun'.run('v') \n endif \n endfunction" + ) vim.cmd("command! -range -nargs=? SnipRun ,call SnipRunLauncher()") end function M.start() - if M.job_id ~= nil then return end + if M.job_id ~= nil then + return + end M.job_id = vim.fn.jobstart({ M.config_values.binary_path }, { rpc = true }) M.setup_highlights() -- some configurations break highlights (lunarvim/lazy for example) end @@ -200,7 +214,7 @@ end function M.run(mode) local range_begin, range_end = M.get_range(mode) M.config_values["sniprun_root_dir"] = M.config_values.sniprun_path - M.notify('run', range_begin, range_end, M.config_values, vim.g.sniprun_cli_args or "") + M.notify("run", range_begin, range_end, M.config_values, vim.g.sniprun_cli_args or "") end function M.get_range(mode) @@ -212,8 +226,8 @@ function M.get_range(mode) line1 = 1 line2 = vim.fn.eval("line('$')") elseif mode:match("[n]") then - line1 = vim.api.nvim_buf_get_mark(0, '[')[1] - line2 = vim.api.nvim_buf_get_mark(0, ']')[1] + line1 = vim.api.nvim_buf_get_mark(0, "[")[1] + line2 = vim.api.nvim_buf_get_mark(0, "]")[1] elseif mode:match("[vV]") then line1 = vim.api.nvim_buf_get_mark(0, "<")[1] line2 = vim.api.nvim_buf_get_mark(0, ">")[1] @@ -260,15 +274,14 @@ function M.display_lines_in_floating_win(lines) local height = math.ceil(vim.o.lines * 0.9) M.info_floatwin.buf = vim.api.nvim_create_buf(false, true) - M.info_floatwin.win = vim.api.nvim_open_win(M.info_floatwin.buf, true, { - relative = 'editor', - style = 'minimal', + relative = "editor", + style = "minimal", width = width, height = height, col = math.ceil((vim.o.columns - width) / 2), row = math.ceil((vim.o.lines - height) / 2 - 1), - border = 'single' + border = "single", }) -- vim.api.nvim_win_set_option(M.info_floatwin.win, 'winhighlight', 'Normal:CursorLine') @@ -286,7 +299,7 @@ function M.info(arg) print(" ") -- default cache dir is different on Linux and MacOS local default_cache_dir = os.getenv("HOME") .. "/.cache" - if (vim.fn.isdirectory(os.getenv("HOME") .. "/Library/Caches") ~= 0) then -- we're (probably) on MacOS + if vim.fn.isdirectory(os.getenv("HOME") .. "/Library/Caches") ~= 0 then -- we're (probably) on MacOS default_cache_dir = os.getenv("HOME") .. "/Library/Caches" end @@ -296,8 +309,9 @@ function M.info(arg) -- print all lines content M.display_lines_in_floating_win(lines) else --help about a particular interpreter - local lines = lines_from(M.config_values.sniprun_path .. - "/doc/sources/interpreters/" .. string.gsub(arg, "%s+", "") .. ".md") + local lines = lines_from( + M.config_values.sniprun_path .. "/doc/sources/interpreters/" .. string.gsub(arg, "%s+", "") .. ".md" + ) M.display_lines_in_floating_win(lines) end end @@ -307,11 +321,13 @@ function M.health() local health_ok = vim.health.ok local health_error = vim.health.error local health_warn = vim.health.warn - health_start('Installation') + health_start("Installation") - if vim.fn.executable('cargo') == 0 then - health_warn("Rust toolchain not available", - { "[optionnal] Install the rust toolchain https://www.rust-lang.org/tools/install" }) + if vim.fn.executable("cargo") == 0 then + health_warn( + "Rust toolchain not available", + { "[optionnal] Install the rust toolchain https://www.rust-lang.org/tools/install" } + ) else health_ok("Rust toolchain found") end @@ -323,8 +339,8 @@ function M.health() end local terminate_after = M.job_id == nil - local path_log_file = os.getenv('HOME') .. "/.cache/sniprun/sniprun.log" - local path_log_file_mac = os.getenv('HOME') .. "/Library/Caches/sniprun/sniprun.log" + local path_log_file = os.getenv("HOME") .. "/.cache/sniprun/sniprun.log" + local path_log_file_mac = os.getenv("HOME") .. "/Library/Caches/sniprun/sniprun.log" os.remove(path_log_file) -- check if the log is recreated @@ -332,14 +348,16 @@ function M.health() health_ok("Sent a ping to the sniprun binary") else health_warn( - "Could not send a ping to the sniprun binary - is it present, executable and compatible with your CPU architecture?") + "Could not send a ping to the sniprun binary - is it present, executable and compatible with your CPU architecture?" + ) end - os.execute("sleep 0.2") if not M.file_exists(path_log_file) and not M.file_exists(path_log_file_mac) then - health_error("sniprun binary incompatible or crash at start", - { "Compile sniprun locally, with a clean reinstall and 'bash ./install.sh 1' as post-install command." }) + health_error( + "sniprun binary incompatible or crash at start", + { "Compile sniprun locally, with a clean reinstall and 'bash ./install.sh 1' as post-install command." } + ) else health_ok("sniprun binary runs correctly") end @@ -350,7 +368,9 @@ function M.file_exists(name) if f ~= nil then io.close(f) return true - else return false end + else + return false + end end return M diff --git a/src/interpreter.rs b/src/interpreter.rs index 0cb29a52..d445a096 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -2,6 +2,7 @@ use crate::error::SniprunError; use crate::DataHolder; use log::info; use std::fmt::Display; +use std::path::PathBuf; #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] #[allow(dead_code)] @@ -203,6 +204,8 @@ pub trait InterpreterUtils { fn get_repl_timeout(data: &DataHolder) -> u64; fn get_compiler_or(data: &DataHolder, or: &str) -> String; fn get_interpreter_or(data: &DataHolder, or: &str) -> String; + + fn get_interpreter_desired_cwd(data: &DataHolder) -> PathBuf; } impl InterpreterUtils for T { @@ -329,6 +332,17 @@ impl InterpreterUtils for T { or.to_string() } + fn get_interpreter_desired_cwd(data: &DataHolder) -> PathBuf { + if let Some(cwd) = T::get_interpreter_option(data, "cwd") { + if let Some(cwd) = cwd.as_str() { + info!("found cwd '{}'", cwd); + return PathBuf::from(cwd); + } + } + // otherwise, use config.cwd if set, or else, neovim's cwd + data.get_desired_cwd() + } + fn error_truncate(data: &DataHolder) -> ErrTruncate { if let Some(error_truncate) = T::get_interpreter_option(data, "error_truncate") { if let Some(error_truncate) = error_truncate.as_str() { diff --git a/src/interpreters/Ada_original.rs b/src/interpreters/Ada_original.rs index 70d7923c..0809b40a 100644 --- a/src/interpreters/Ada_original.rs +++ b/src/interpreters/Ada_original.rs @@ -110,6 +110,7 @@ impl Interpreter for Ada_original { let compiler = Ada_original::get_compiler_or(&self.data, "gnatmake"); let output = Command::new(compiler.split_whitespace().next().unwrap()) + .current_dir(Ada_original::get_interpreter_desired_cwd(&self.data)) .args(compiler.split_whitespace().skip(1)) .arg("main") .arg(&self.main_file_path) @@ -127,6 +128,7 @@ impl Interpreter for Ada_original { fn execute(&mut self) -> Result { let output = Command::new(&self.bin_path) + .current_dir(Ada_original::get_interpreter_desired_cwd(&self.data)) .output() .expect("Unable to start process"); diff --git a/src/interpreters/Bash_original.rs b/src/interpreters/Bash_original.rs index 4c7e7b9a..313c060f 100644 --- a/src/interpreters/Bash_original.rs +++ b/src/interpreters/Bash_original.rs @@ -113,6 +113,7 @@ impl Interpreter for Bash_original { fn execute(&mut self) -> Result { let interpreter = Bash_original::get_interpreter_or(&self.data, "bash"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(Bash_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) diff --git a/src/interpreters/CS_original.rs b/src/interpreters/CS_original.rs index e573c914..e9213a3b 100644 --- a/src/interpreters/CS_original.rs +++ b/src/interpreters/CS_original.rs @@ -98,6 +98,7 @@ impl Interpreter for CS_original { fn execute(&mut self) -> Result { let interpreter = CS_original::get_interpreter_or(&self.data, "coffee"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(CS_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) diff --git a/src/interpreters/CSharp_original.rs b/src/interpreters/CSharp_original.rs index cafd32c9..eb4c42f0 100644 --- a/src/interpreters/CSharp_original.rs +++ b/src/interpreters/CSharp_original.rs @@ -133,6 +133,7 @@ impl Interpreter for CSharp_original { //compile it (to the bin_path that arleady points to the rigth path) let output = Command::new(self.compiler.split_whitespace().next().unwrap()) + .current_dir(CSharp_original::get_interpreter_desired_cwd(&self.data)) .args(self.compiler.split_whitespace().skip(1)) .arg(String::from("-out:") + &self.bin_path) .arg(&self.main_file_path) @@ -158,6 +159,7 @@ impl Interpreter for CSharp_original { fn execute(&mut self) -> Result { //run th binary and get the std output (or stderr) let output = Command::new("mono") + .current_dir(CSharp_original::get_interpreter_desired_cwd(&self.data)) .arg(&self.bin_path) .args(&self.get_data().cli_args) .output() diff --git a/src/interpreters/C_original.rs b/src/interpreters/C_original.rs index 787709ff..302ab4ce 100644 --- a/src/interpreters/C_original.rs +++ b/src/interpreters/C_original.rs @@ -55,8 +55,7 @@ impl C_original { fn fetch_config(&mut self) { let default_compiler = String::from("gcc"); self.compiler = default_compiler; - if let Some(used_compiler) = - C_original::get_interpreter_option(self.get_data(), "compiler") + if let Some(used_compiler) = C_original::get_interpreter_option(self.get_data(), "compiler") { if let Some(compiler_string) = used_compiler.as_str() { info!("Using custom compiler: {}", compiler_string); @@ -185,6 +184,7 @@ impl Interpreter for C_original { write(&self.main_file_path, &self.code).expect("Unable to write to file for c-original"); let mut cmd = Command::new(self.compiler.split_whitespace().next().unwrap()); let cmd = cmd + .current_dir(C_original::get_interpreter_desired_cwd(&self.data)) .args(self.compiler.split_whitespace().skip(1)) .arg(&self.main_file_path) .arg("-o") @@ -233,6 +233,7 @@ impl Interpreter for C_original { fn execute(&mut self) -> Result { let output = Command::new(&self.bin_path) + .current_dir(C_original::get_interpreter_desired_cwd(&self.data)) .args(&self.get_data().cli_args) .output() .expect("Unable to start process"); diff --git a/src/interpreters/Clojure_fifo.rs b/src/interpreters/Clojure_fifo.rs index c0e850e0..e241d1be 100644 --- a/src/interpreters/Clojure_fifo.rs +++ b/src/interpreters/Clojure_fifo.rs @@ -218,6 +218,7 @@ impl Interpreter for Clojure_fifo { } fn execute(&mut self) -> Result { let output = Command::new(self.interpreter.split_whitespace().next().unwrap()) + .current_dir(Clojure_fifo::get_interpreter_desired_cwd(&self.data)) .args(self.interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) @@ -278,6 +279,7 @@ impl ReplLikeInterpreter for Clojure_fifo { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(Clojure_fifo::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -331,6 +333,7 @@ impl ReplLikeInterpreter for Clojure_fifo { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(Clojure_fifo::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/Cpp_original.rs b/src/interpreters/Cpp_original.rs index 92798f67..95a0e01d 100644 --- a/src/interpreters/Cpp_original.rs +++ b/src/interpreters/Cpp_original.rs @@ -158,6 +158,7 @@ impl Interpreter for Cpp_original { File::create(&self.main_file_path).expect("Failed to create file for rust-original"); write(&self.main_file_path, &self.code).expect("Unable to write to file for rust-original"); let output = Command::new(self.compiler.split_whitespace().next().unwrap()) + .current_dir(Cpp_original::get_interpreter_desired_cwd(&self.data)) .args(self.compiler.split_whitespace().skip(1)) .arg(&self.main_file_path) .arg("-o") @@ -197,6 +198,7 @@ impl Interpreter for Cpp_original { fn execute(&mut self) -> Result { let output = Command::new(&self.bin_path) + .current_dir(Cpp_original::get_interpreter_desired_cwd(&self.data)) .args(&self.get_data().cli_args) .output() .expect("Unable to start process"); diff --git a/src/interpreters/D_original.rs b/src/interpreters/D_original.rs index 113f3efa..be859808 100644 --- a/src/interpreters/D_original.rs +++ b/src/interpreters/D_original.rs @@ -97,6 +97,7 @@ impl Interpreter for D_original { //run th binary and get the std output (or stderr) let interpreter = D_original::get_interpreter_or(&self.data, "dmd"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(D_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg("-run") .arg(&self.main_file_path) diff --git a/src/interpreters/Elixir_original.rs b/src/interpreters/Elixir_original.rs index e7469772..8b48f6f2 100644 --- a/src/interpreters/Elixir_original.rs +++ b/src/interpreters/Elixir_original.rs @@ -171,6 +171,7 @@ impl Interpreter for Elixir_original { fn execute(&mut self) -> Result { let interpreter = Elixir_original::get_interpreter_or(&self.data, "elixir"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(Elixir_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) @@ -226,6 +227,7 @@ impl ReplLikeInterpreter for Elixir_original { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(Elixir_original::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -272,6 +274,7 @@ impl ReplLikeInterpreter for Elixir_original { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher (via {})", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(Elixir_original::get_interpreter_desired_cwd(&self.data)) .arg(self.cache_dir.clone() + "/main.exs") .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn() diff --git a/src/interpreters/FSharp_fifo.rs b/src/interpreters/FSharp_fifo.rs index 78f6754c..fc9558c7 100644 --- a/src/interpreters/FSharp_fifo.rs +++ b/src/interpreters/FSharp_fifo.rs @@ -200,6 +200,7 @@ impl Interpreter for FSharp_fifo { } fn execute(&mut self) -> Result { let output = Command::new(self.interpreter.split_whitespace().next().unwrap()) + .current_dir(FSharp_fifo::get_interpreter_desired_cwd(&self.data)) .args(self.interpreter.split_whitespace().skip(1)) .arg(&self.interpreter) .arg(&self.main_file_path) @@ -260,6 +261,7 @@ impl ReplLikeInterpreter for FSharp_fifo { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(FSharp_fifo::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -329,6 +331,7 @@ impl ReplLikeInterpreter for FSharp_fifo { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(FSharp_fifo::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/Generic.rs b/src/interpreters/Generic.rs index 85bf6f27..c010d676 100644 --- a/src/interpreters/Generic.rs +++ b/src/interpreters/Generic.rs @@ -320,6 +320,7 @@ impl Interpreter for Generic { info!("compiling main file to exe"); let output = Command::new(self.compiler.split_whitespace().next().unwrap()) + .current_dir(Generic::get_interpreter_desired_cwd(&self.data)) .args(self.compiler.split_whitespace().skip(1)) .arg(&self.main_file_path) .current_dir(&self.workdir) @@ -353,6 +354,7 @@ impl Interpreter for Generic { fn execute(&mut self) -> Result { let output = if self.interpreted_lang { Command::new(self.interpreter.split_whitespace().next().unwrap()) + .current_dir(Generic::get_interpreter_desired_cwd(&self.data)) .args(self.interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) @@ -361,6 +363,7 @@ impl Interpreter for Generic { .expect("Unable to start process specified in Generic's config") } else { Command::new(self.exe_path.clone()) + .current_dir(Generic::get_interpreter_desired_cwd(&self.data)) .args(&self.get_data().cli_args) .current_dir(&self.workdir) .output() diff --git a/src/interpreters/Go_original.rs b/src/interpreters/Go_original.rs index 16522f35..af7876b0 100644 --- a/src/interpreters/Go_original.rs +++ b/src/interpreters/Go_original.rs @@ -245,6 +245,7 @@ impl Interpreter for Go_original { //compile it (to the bin_path that arleady points to the rigth path) let output = Command::new(self.compiler.split_whitespace().next().unwrap()) + .current_dir(Go_original::get_interpreter_desired_cwd(&self.data)) .args(self.compiler.split_whitespace().skip(1)) .arg("build") .arg("-o") @@ -277,6 +278,7 @@ impl Interpreter for Go_original { fn execute(&mut self) -> Result { //run th binary and get the std output (or stderr) let output = Command::new(&self.bin_path) + .current_dir(Go_original::get_interpreter_desired_cwd(&self.data)) .args(&self.get_data().cli_args) .output() .expect("Unable to start process"); diff --git a/src/interpreters/Haskell_original.rs b/src/interpreters/Haskell_original.rs index f25663e7..8d1111ae 100644 --- a/src/interpreters/Haskell_original.rs +++ b/src/interpreters/Haskell_original.rs @@ -111,6 +111,7 @@ impl Interpreter for Haskell_original { ); let compiler = Haskell_original::get_compiler_or(&self.data, "ghc"); let output = Command::new(compiler.split_whitespace().next().unwrap()) + .current_dir(Haskell_original::get_interpreter_desired_cwd(&self.data)) .args(compiler.split_whitespace().skip(1)) .arg("-dynamic") .arg("-o") @@ -133,6 +134,7 @@ impl Interpreter for Haskell_original { fn execute(&mut self) -> Result { //run th binary and get the std output (or stderr) let output = Command::new(&self.bin_path) + .current_dir(Haskell_original::get_interpreter_desired_cwd(&self.data)) .args(&self.get_data().cli_args) .output() .expect("Unable to start process"); diff --git a/src/interpreters/JS_TS_bun.rs b/src/interpreters/JS_TS_bun.rs index c05b53c9..bfcd87f0 100644 --- a/src/interpreters/JS_TS_bun.rs +++ b/src/interpreters/JS_TS_bun.rs @@ -205,6 +205,7 @@ impl Interpreter for JS_TS_bun { } let interpreter = JS_TS_bun::get_interpreter_or(&self.data, "bun"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(JS_TS_bun::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg("run") .arg("--silent") @@ -271,6 +272,7 @@ impl ReplLikeInterpreter for JS_TS_bun { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(JS_TS_bun::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -329,6 +331,7 @@ impl ReplLikeInterpreter for JS_TS_bun { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(JS_TS_bun::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/JS_TS_deno.rs b/src/interpreters/JS_TS_deno.rs index 045d19f2..6895160f 100644 --- a/src/interpreters/JS_TS_deno.rs +++ b/src/interpreters/JS_TS_deno.rs @@ -220,6 +220,7 @@ impl Interpreter for JS_TS_deno { //run the binary and get the std output (or stderr) let interpreter = JS_TS_deno::get_interpreter_or(&self.data, "deno"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(JS_TS_deno::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg("run") .arg("-A") @@ -287,6 +288,7 @@ impl ReplLikeInterpreter for JS_TS_deno { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(JS_TS_deno::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -349,6 +351,7 @@ impl ReplLikeInterpreter for JS_TS_deno { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(JS_TS_deno::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/JS_original.rs b/src/interpreters/JS_original.rs index cdb974b3..befb1ae7 100644 --- a/src/interpreters/JS_original.rs +++ b/src/interpreters/JS_original.rs @@ -99,6 +99,7 @@ impl Interpreter for JS_original { fn execute(&mut self) -> Result { let interpreter = JS_original::get_interpreter_or(&self.data, "node"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(JS_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) diff --git a/src/interpreters/Java_original.rs b/src/interpreters/Java_original.rs index 49f24a17..e024aa7c 100644 --- a/src/interpreters/Java_original.rs +++ b/src/interpreters/Java_original.rs @@ -107,6 +107,7 @@ impl Interpreter for Java_original { let compiler = Java_original::get_compiler_or(&self.data, "javac"); //compile it (to the bin_path that arleady points to the rigth path) let output = Command::new(compiler.split_whitespace().next().unwrap()) + .current_dir(Java_original::get_interpreter_desired_cwd(&self.data)) .args(compiler.split_whitespace().skip(1)) .arg("-d") .arg(&self.java_work_dir) @@ -125,6 +126,7 @@ impl Interpreter for Java_original { fn execute(&mut self) -> Result { //run th binary and get the std output (or stderr) let output = Command::new("java") + .current_dir(Java_original::get_interpreter_desired_cwd(&self.data)) .arg("-cp") .arg(&self.java_work_dir) .arg(&self.bin_name) diff --git a/src/interpreters/Julia_jupyter.rs b/src/interpreters/Julia_jupyter.rs index 4ef0957e..5aea1050 100644 --- a/src/interpreters/Julia_jupyter.rs +++ b/src/interpreters/Julia_jupyter.rs @@ -102,6 +102,7 @@ impl Interpreter for Julia_jupyter { } fn execute(&mut self) -> Result { let output = Command::new("julia") + .current_dir(Julia_jupyter::get_interpreter_desired_cwd(&self.data)) .arg(&self.main_file_path) .output() .expect("Unable to start process"); @@ -175,6 +176,7 @@ impl ReplLikeInterpreter for Julia_jupyter { fn execute_repl(&mut self) -> Result { info!("starting executing repl: bash {}", &self.launcher_path); let output = Command::new("bash") + .current_dir(Julia_jupyter::get_interpreter_desired_cwd(&self.data)) .arg(&self.launcher_path) .output() .expect("failed to run command"); diff --git a/src/interpreters/Julia_original.rs b/src/interpreters/Julia_original.rs index 7f201c6a..ff1aad32 100644 --- a/src/interpreters/Julia_original.rs +++ b/src/interpreters/Julia_original.rs @@ -188,6 +188,7 @@ impl Interpreter for Julia_original { } fn execute(&mut self) -> Result { let output = Command::new(self.interpreter.split_whitespace().next().unwrap()) + .current_dir(Julia_original::get_interpreter_desired_cwd(&self.data)) .args(self.interpreter.split_whitespace().skip(1)) .args(&self.interpreter_args) .arg(&self.main_file_path) @@ -245,6 +246,7 @@ impl ReplLikeInterpreter for Julia_original { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(Julia_original::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -299,6 +301,7 @@ impl ReplLikeInterpreter for Julia_original { info!("running launcher"); let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; let res = Command::new(send_repl_cmd) + .current_dir(Julia_original::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn() diff --git a/src/interpreters/Lua_nvim.rs b/src/interpreters/Lua_nvim.rs index 1b320bd9..6cc9c7ad 100644 --- a/src/interpreters/Lua_nvim.rs +++ b/src/interpreters/Lua_nvim.rs @@ -122,6 +122,7 @@ impl Interpreter for Lua_nvim { fn execute(&mut self) -> Result { let interpreter = Lua_nvim::get_interpreter_or(&self.data, "nvim"); let output = Command::new(interpreter) + .current_dir(Lua_nvim::get_interpreter_desired_cwd(&self.data)) .arg("--headless") .arg("-c") .arg(format!("luafile {}", &self.main_file_path)) diff --git a/src/interpreters/Lua_original.rs b/src/interpreters/Lua_original.rs index 3357d055..519fbb5c 100644 --- a/src/interpreters/Lua_original.rs +++ b/src/interpreters/Lua_original.rs @@ -113,6 +113,7 @@ impl Interpreter for Lua_original { fn execute(&mut self) -> Result { let interpreter = Lua_original::get_interpreter_or(&self.data, "lua"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(Lua_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) diff --git a/src/interpreters/Mathematica_original.rs b/src/interpreters/Mathematica_original.rs index adf563c6..2758b183 100644 --- a/src/interpreters/Mathematica_original.rs +++ b/src/interpreters/Mathematica_original.rs @@ -250,6 +250,9 @@ impl Interpreter for Mathematica_original { //run th binary and get the std output (or stderr) let interpreter = Mathematica_original::get_interpreter_or(&self.data, "WolframKernel"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(Mathematica_original::get_interpreter_desired_cwd( + &self.data, + )) .args(interpreter.split_whitespace().skip(1)) .arg("-noprompt") .arg("-script") @@ -301,6 +304,9 @@ impl ReplLikeInterpreter for Mathematica_original { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(Mathematica_original::get_interpreter_desired_cwd( + &self.data, + )) .args(&[init_repl_cmd, self.language_work_dir.clone()]) .output() .unwrap(); @@ -372,6 +378,9 @@ impl ReplLikeInterpreter for Mathematica_original { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/src/interpreters/Mathematica_original/launcher.sh"; let res = Command::new(send_repl_cmd) + .current_dir(Mathematica_original::get_interpreter_desired_cwd( + &self.data, + )) .arg(self.language_work_dir.clone() + "/main.mma") .arg(self.language_work_dir.clone() + "/pipe_in") .spawn() diff --git a/src/interpreters/OCaml_fifo.rs b/src/interpreters/OCaml_fifo.rs index ccd29fb3..18b26239 100644 --- a/src/interpreters/OCaml_fifo.rs +++ b/src/interpreters/OCaml_fifo.rs @@ -196,6 +196,7 @@ impl Interpreter for OCaml_fifo { } fn execute(&mut self) -> Result { let output = Command::new(self.interpreter.clone()) + .current_dir(OCaml_fifo::get_interpreter_desired_cwd(&self.data)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) .output() @@ -255,6 +256,7 @@ impl ReplLikeInterpreter for OCaml_fifo { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(OCaml_fifo::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -308,6 +310,7 @@ impl ReplLikeInterpreter for OCaml_fifo { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(OCaml_fifo::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/PHP_original.rs b/src/interpreters/PHP_original.rs index 94f9ab44..be65ae12 100644 --- a/src/interpreters/PHP_original.rs +++ b/src/interpreters/PHP_original.rs @@ -203,6 +203,7 @@ impl Interpreter for PHP_original { self.interpreter ); let output = Command::new(&self.interpreter) + .current_dir(PHP_original::get_interpreter_desired_cwd(&self.data)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) .output() @@ -260,6 +261,7 @@ impl ReplLikeInterpreter for PHP_original { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(PHP_original::get_interpreter_desired_cwd(&self.data)) .arg(init_repl_cmd) .arg(&self.cache_dir) .arg(PHP_original::get_nvim_pid(&self.data)) @@ -291,6 +293,7 @@ impl ReplLikeInterpreter for PHP_original { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(PHP_original::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/Plantuml_original.rs b/src/interpreters/Plantuml_original.rs index 69c0f447..1ec00d42 100644 --- a/src/interpreters/Plantuml_original.rs +++ b/src/interpreters/Plantuml_original.rs @@ -204,6 +204,7 @@ impl Interpreter for Plantuml_original { let compiler = Plantuml_original::get_compiler_or(&self.data, "plantuml"); //compile it (to the bin_path that already points to the rigth path) let output = Command::new(compiler.split_whitespace().next().unwrap()) + .current_dir(Plantuml_original::get_interpreter_desired_cwd(&self.data)) .args(compiler.split_whitespace().skip(1)) .arg("-o") .arg(&self.language_work_dir) diff --git a/src/interpreters/Python3_fifo.rs b/src/interpreters/Python3_fifo.rs index d3c6a955..2487a91e 100644 --- a/src/interpreters/Python3_fifo.rs +++ b/src/interpreters/Python3_fifo.rs @@ -419,6 +419,7 @@ impl ReplLikeInterpreter for Python3_fifo { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(Python3_fifo::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -515,6 +516,7 @@ impl ReplLikeInterpreter for Python3_fifo { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(Python3_fifo::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/Python3_jupyter.rs b/src/interpreters/Python3_jupyter.rs index 440238dd..247eeb7d 100644 --- a/src/interpreters/Python3_jupyter.rs +++ b/src/interpreters/Python3_jupyter.rs @@ -217,6 +217,7 @@ impl Interpreter for Python3_jupyter { } fn execute(&mut self) -> Result { let output = Command::new("python3") + .current_dir(Python3_jupyter::get_interpreter_desired_cwd(&self.data)) .arg(&self.main_file_path) .output() .expect("Unable to start process"); @@ -249,6 +250,7 @@ impl ReplLikeInterpreter for Python3_jupyter { //this will be cleared by the SnipReplMemoryClean command let _res = std::fs::remove_file(&self.kernel_file); let _res = Command::new("jupyter-kernel") + .current_dir(Python3_jupyter::get_interpreter_desired_cwd(&self.data)) .arg("--kernel=python3") .arg(String::from("--KernelManager.connection_file=") + &self.kernel_file) .spawn(); @@ -338,6 +340,7 @@ impl ReplLikeInterpreter for Python3_jupyter { self.wait_on_kernel()?; let output = Command::new("sh") + .current_dir(Python3_jupyter::get_interpreter_desired_cwd(&self.data)) .arg(&self.launcher_path) .output() .expect("Unable to start process"); diff --git a/src/interpreters/Python3_original.rs b/src/interpreters/Python3_original.rs index f6f2026b..5075f257 100644 --- a/src/interpreters/Python3_original.rs +++ b/src/interpreters/Python3_original.rs @@ -261,6 +261,7 @@ impl Interpreter for Python3_original { } fn execute(&mut self) -> Result { let output = Command::new(self.interpreter.split_whitespace().next().unwrap()) + .current_dir(Python3_original::get_interpreter_desired_cwd(&self.data)) .args(self.interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) diff --git a/src/interpreters/R_original.rs b/src/interpreters/R_original.rs index 8eeba4a5..eb9b4f13 100644 --- a/src/interpreters/R_original.rs +++ b/src/interpreters/R_original.rs @@ -103,6 +103,7 @@ impl Interpreter for R_original { fn execute(&mut self) -> Result { let interpreter = R_original::get_interpreter_or(&self.data, "Rscript"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(R_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) diff --git a/src/interpreters/Ruby_original.rs b/src/interpreters/Ruby_original.rs index 7eff16d0..b4153a7c 100644 --- a/src/interpreters/Ruby_original.rs +++ b/src/interpreters/Ruby_original.rs @@ -99,6 +99,7 @@ impl Interpreter for Ruby_original { fn execute(&mut self) -> Result { let interpreter = Ruby_original::get_interpreter_or(&self.data, "ruby"); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(Ruby_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .args(&self.get_data().cli_args) diff --git a/src/interpreters/Rust_original.rs b/src/interpreters/Rust_original.rs index fb0465b8..074646e2 100644 --- a/src/interpreters/Rust_original.rs +++ b/src/interpreters/Rust_original.rs @@ -227,6 +227,7 @@ impl Interpreter for Rust_original { //compile it (to the bin_path that arleady points to the rigth path) let output = Command::new(self.compiler.split_whitespace().next().unwrap()) + .current_dir(Rust_original::get_interpreter_desired_cwd(&self.data)) .args(self.compiler.split_whitespace().skip(1)) .arg("--out-dir") .arg(&self.rust_work_dir) @@ -255,6 +256,7 @@ impl Interpreter for Rust_original { //run th binary and get the std output (or stderr) let output = Command::new(&self.bin_path) .args(&self.get_data().cli_args) + .current_dir(Rust_original::get_interpreter_desired_cwd(&self.data)) .output() .expect("Unable to start process"); if output.status.success() { @@ -369,6 +371,7 @@ impl ReplLikeInterpreter for Rust_original { match daemon() { Ok(Fork::Child) => { let _res = Command::new("bash") + .current_dir(Rust_original::get_interpreter_desired_cwd(&self.data)) .args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -440,6 +443,7 @@ impl ReplLikeInterpreter for Rust_original { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(Rust_original::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/SQL_original.rs b/src/interpreters/SQL_original.rs index 411df9d1..1792c7bd 100644 --- a/src/interpreters/SQL_original.rs +++ b/src/interpreters/SQL_original.rs @@ -113,7 +113,7 @@ impl Interpreter for SQL_original { .arg("--file") .arg(&self.main_file_path) .arg(self.read_previous_code().replace('\n', "")) // contains database address - .current_dir(&self.data.projectroot) + .current_dir(SQL_original::get_interpreter_desired_cwd(&self.data)) .output() .expect("Unable to start process"); if output.status.success() { diff --git a/src/interpreters/Sage_fifo.rs b/src/interpreters/Sage_fifo.rs index f8d4268d..80fc8a09 100644 --- a/src/interpreters/Sage_fifo.rs +++ b/src/interpreters/Sage_fifo.rs @@ -452,6 +452,7 @@ impl ReplLikeInterpreter for Sage_fifo { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(Sage_fifo::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/Scala_original.rs b/src/interpreters/Scala_original.rs index 23f2733f..30e60406 100644 --- a/src/interpreters/Scala_original.rs +++ b/src/interpreters/Scala_original.rs @@ -117,6 +117,7 @@ impl Interpreter for Scala_original { let compiler = Scala_original::get_compiler_or(&self.data, "scalac"); //compile it (to the bin_path that arleady points to the rigth path) let output = Command::new(compiler.split_whitespace().next().unwrap()) + .current_dir(Scala_original::get_interpreter_desired_cwd(&self.data)) .args(compiler.split_whitespace().skip(1)) .arg("-d") .arg(&self.language_work_dir) @@ -139,6 +140,7 @@ impl Interpreter for Scala_original { //run th binary and get the std output (or stderr) let interpreter = Scala_original::get_interpreter_or(&self.data, "scala"); let output = Command::new(interpreter) + .current_dir(Scala_original::get_interpreter_desired_cwd(&self.data)) .arg("Main") .current_dir(&self.language_work_dir) .output() diff --git a/src/interpreters/Swift_original.rs b/src/interpreters/Swift_original.rs index e9c13d50..ea3c6f9a 100644 --- a/src/interpreters/Swift_original.rs +++ b/src/interpreters/Swift_original.rs @@ -269,6 +269,7 @@ impl Interpreter for Swift_original { .expect("Unable to write to file for swift-original"); let mut cmd = Command::new(self.compiler.split_whitespace().next().unwrap()); let cmd = cmd + .current_dir(Swift_original::get_interpreter_desired_cwd(&self.data)) .args(self.compiler.split_whitespace().skip(1)) .arg(&self.main_file_path) .arg("-o") @@ -293,7 +294,9 @@ impl Interpreter for Swift_original { } fn execute(&mut self) -> Result { let mut cmd = Command::new(&self.bin_path); - cmd.args(&self.get_data().cli_args); + let cmd = cmd + .current_dir(Swift_original::get_interpreter_desired_cwd(&self.data)) + .args(&self.get_data().cli_args); info!("cmd: {:?}", &cmd); let output = cmd.output().expect("Unable to start process"); @@ -348,6 +351,7 @@ impl ReplLikeInterpreter for Swift_original { init_repl_cmd, &self.cache_dir ); let mut cmd = Command::new("bash"); + let cmd = cmd.current_dir(Swift_original::get_interpreter_desired_cwd(&self.data)); cmd.args(&[ init_repl_cmd.clone(), self.cache_dir.clone(), @@ -363,6 +367,8 @@ impl ReplLikeInterpreter for Swift_original { match daemon() { Ok(Fork::Child) => { let mut cmd = Command::new("bash"); + let cmd = + cmd.current_dir(Swift_original::get_interpreter_desired_cwd(&self.data)); cmd.args(&[ init_repl_cmd, self.cache_dir.clone(), @@ -422,6 +428,7 @@ impl ReplLikeInterpreter for Swift_original { let send_repl_cmd = self.data.sniprun_root_dir.clone() + "/ressources/launcher_repl.sh"; info!("running launcher {}", send_repl_cmd); let res = Command::new(send_repl_cmd) + .current_dir(Swift_original::get_interpreter_desired_cwd(&self.data)) .arg(self.main_file_path.clone()) .arg(self.cache_dir.clone() + "/fifo_repl/pipe_in") .spawn(); diff --git a/src/interpreters/TypeScript_original.rs b/src/interpreters/TypeScript_original.rs index 7f7f6001..d7517b66 100644 --- a/src/interpreters/TypeScript_original.rs +++ b/src/interpreters/TypeScript_original.rs @@ -128,6 +128,7 @@ impl Interpreter for TypeScript_original { //run th binary and get the std output (or stderr) let interpreter = TypeScript_original::get_interpreter_or(&self.data, &self.interpreter); let output = Command::new(interpreter.split_whitespace().next().unwrap()) + .current_dir(TypeScript_original::get_interpreter_desired_cwd(&self.data)) .args(interpreter.split_whitespace().skip(1)) .arg(&self.main_file_path) .output() diff --git a/src/lib.rs b/src/lib.rs index f851f6b3..10b49a3d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,7 @@ pub use display::{display, display_floating_window, DisplayFilter::*, DisplayTyp use log::{info, LevelFilter}; use neovim_lib::{Neovim, NeovimApi, Session, Value}; use simple_logging::log_to_file; +use std::path::PathBuf; use std::str::FromStr; use std::sync::{mpsc, Arc, Mutex}; use std::thread; @@ -59,6 +60,10 @@ pub struct DataHolder { ///interpreter options pub interpreter_options: Option, + /// user config, expressing the desired working dir for the spawned + /// interpreter / exe processes. if "." or unset, uses projectroot + pub cwd: Option, + ///interpreter data pub interpreter_data: Option>>, @@ -112,6 +117,9 @@ impl Default for DataHolder { range: [-1, -1], filepath: String::new(), projectroot: String::new(), + cwd: std::env::current_dir() + .ok() + .map(|path| path.to_string_lossy().to_string()), dependencies_path: vec![], work_dir: format!("{}/{}", cache_dir().unwrap().to_str().unwrap(), "sniprun"), sniprun_root_dir: String::new(), @@ -158,6 +166,15 @@ impl DataHolder { self.current_line = real_current_bloc[0].to_string(); } } + + pub fn get_desired_cwd(&self) -> PathBuf { + if let Some(cwd) = &self.cwd { + if cwd != "." { + return PathBuf::from(&cwd); + } + } + PathBuf::from(&self.projectroot) + } } #[derive(Clone)] @@ -254,6 +271,12 @@ impl EventHandler { info!("[FILLDATA] got sniprun root"); } } + { + if let Some(i) = self.index_from_name("cwd", config) { + self.data.cwd = Some(String::from(config[i].1.as_str().unwrap())); + info!("[FILLDATA] got sniprun config cwd"); + } + } { //get neovim's current directory From be5ca9d1527ebc37d5edc63d5ea9933709bb0227 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Tue, 9 Dec 2025 20:18:36 +0100 Subject: [PATCH 5/9] documents cwd config --- doc/sources/README.md | 3 +++ doc/sources/common_options.md | 23 ++++++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/doc/sources/README.md b/doc/sources/README.md index 61c3bc99..e6cb7e73 100755 --- a/doc/sources/README.md +++ b/doc/sources/README.md @@ -290,6 +290,9 @@ require'sniprun'.setup({ "TempFloatingWindow", --# implies LongTempFloatingWindow, which has no effect on its own }, + cwd = '.', --# set the working directory for build/run processes. By default or if set to '.', + --# is neovim's current working directory. Can be overwritten by interpreter-options + --# customize highlight groups (setting this overrides colorscheme) --# any parameters of nvim_set_hl() can be passed as-is snipruncolors = { diff --git a/doc/sources/common_options.md b/doc/sources/common_options.md index 118f59af..98873963 100644 --- a/doc/sources/common_options.md +++ b/doc/sources/common_options.md @@ -75,7 +75,7 @@ EOF The `use_on_filetypes` key is implicitely an option of every interpreter -``` +```lua interpreter_options = { GFM_original = { use_on_filetypes = {"markdown.pandoc", "rstudio" } @@ -125,7 +125,7 @@ Almost every interpreter support either the "interpreter" or "compiler" key even example: -``` +```lua interpreter_options = { Python3_original = { interpreter = "python3.9" @@ -133,7 +133,7 @@ interpreter_options = { Rust_original = { compiler = "/home/user/bin/rustc-patched -Zlocation-detail=none" } -}, +} ``` You can see what interpreters/compilers are being used at any time by watching sniprun's log for the line @@ -148,3 +148,20 @@ Exceptions: as they rely on the underlying interpreter for the code's block language and use its configuration. +### The "cwd" key + +This key is supported by all interpreters and allows setting a specific +current working directory for all sub-processes (build, run, REPL processes...). + +This key overwrites the global 'cwd' config field on a per-interpreter basis, which +itself defaults to the Neovim's current working directory. + +If set, the pointed location must exist prior to running anything. + +```lua +interpreter_options = { + Python3_original = { + cwd = "/tmp/python_projects" + } +} +``` From ce7c6ae52635833f33b1680ba1c9f8f150506e7e Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Tue, 9 Dec 2025 20:27:23 +0100 Subject: [PATCH 6/9] upgrade uv stuff to hopefully disable zizmor warning --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 63b80445..19f15e31 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 with: persist-credentials: false - - uses: astral-sh/setup-uv@c7f87aa956e4c323abf06d5dec078e358f6b4d04 + - uses: astral-sh/setup-uv@v7.1.5 - name: run zizmor ci analysis tool run: uvx zizmor --format sarif . > results.sarif env: From d5067b507c3fda50d9c94a5f494b59ace3383083 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Tue, 30 Dec 2025 11:58:03 +0100 Subject: [PATCH 7/9] format --- src/interpreters/Neorg_original.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/interpreters/Neorg_original.rs b/src/interpreters/Neorg_original.rs index f59ee183..55a20777 100644 --- a/src/interpreters/Neorg_original.rs +++ b/src/interpreters/Neorg_original.rs @@ -220,10 +220,9 @@ impl Interpreter for Neorg_original { default_filetype: ddf, }); - if let Some(value) = Neorg_original::get_interpreter_option( - neorg_interpreter.get_data(), - "default_filetype", - ) { + if let Some(value) = + Neorg_original::get_interpreter_option(neorg_interpreter.get_data(), "default_filetype") + { if let Some(valid_string) = value.as_str() { neorg_interpreter.default_filetype = valid_string.to_string(); } From 6d7bac487a9a2e9b1cd233eed502b9616c1ba412 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Tue, 30 Dec 2025 12:00:40 +0100 Subject: [PATCH 8/9] remove beta tag, update changelog --- CHANGELOG.md | 4 ++++ Cargo.lock | 58 ++++++++++++++++++++++++++-------------------------- Cargo.toml | 2 +- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88308b75..67e7a4ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## v1.3.21 +- Settable current working directory +- Fix window/terminal close bug + ## v1.3.20 - PHP repl, Rust repl fixes - Python3_original import indentation fix diff --git a/Cargo.lock b/Cargo.lock index 07a057a4..722b712d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,7 +40,7 @@ checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.3", + "cfg-if 1.0.4", "libc", "miniz_oxide 0.7.4", "object", @@ -55,9 +55,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bitflags" -version = "2.9.4" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "byteorder" @@ -89,9 +89,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cfg-if" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "close_fds" @@ -99,7 +99,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bc416f33de9d59e79e57560f450d21ff8393adcf1cdfc3e6d8fb93d5f88a2ed" dependencies = [ - "cfg-if 1.0.3", + "cfg-if 1.0.4", "libc", ] @@ -125,7 +125,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ - "cfg-if 1.0.3", + "cfg-if 1.0.4", ] [[package]] @@ -134,7 +134,7 @@ version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ - "cfg-if 1.0.3", + "cfg-if 1.0.4", "hashbrown", "lock_api", "once_cell", @@ -174,7 +174,7 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" dependencies = [ - "cfg-if 1.0.3", + "cfg-if 1.0.4", "crc32fast", "libc", "miniz_oxide 0.4.4", @@ -278,7 +278,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ - "cfg-if 1.0.3", + "cfg-if 1.0.4", "libc", "wasi", ] @@ -344,15 +344,15 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.177" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "df15f6eac291ed1cf25865b1ee60399f57e7c227e7f51bdbd4c5270396a9ed50" dependencies = [ "bitflags", "libc", @@ -473,7 +473,7 @@ version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" dependencies = [ - "cfg-if 1.0.3", + "cfg-if 1.0.4", "libc", "redox_syscall 0.5.18", "smallvec", @@ -500,9 +500,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "proc-macro2" -version = "1.0.101" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" +checksum = "8e0f6df8eaa422d97d72edcd152e1451618fed47fabbdbd5a8864167b1d4aff7" dependencies = [ "unicode-ident", ] @@ -544,9 +544,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a52d8d02cacdb176ef4678de6c052efb4b3da14b78e4db683a4252762be5433" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -556,9 +556,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "722166aa0d7438abbaa4d5cc2c649dac844e8c56d82fb3d33e9c34b5cd268fc6" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -567,9 +567,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3160422bbd54dd5ecfdca71e5fd59b7b8fe2b1697ab2baf64f6d05dcc66d298" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "ring" @@ -578,7 +578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da5349ae27d3887ca812fb375b45a4fbb36d8d12d2df394968cd86e35683fe73" dependencies = [ "cc", - "cfg-if 1.0.3", + "cfg-if 1.0.4", "getrandom", "libc", "untrusted", @@ -818,7 +818,7 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "sniprun" -version = "1.3.21-beta" +version = "1.3.21" dependencies = [ "backtrace", "close_fds", @@ -856,9 +856,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.106" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", @@ -919,9 +919,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" [[package]] name = "unicode-normalization" diff --git a/Cargo.toml b/Cargo.toml index 8619f5c8..4534699e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sniprun" -version = "1.3.21-beta" +version = "1.3.21" authors = ["michaelb "] rust-version = "1.65" edition = "2018" From c4378262b12a16081999d8d2990c87a748234317 Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Tue, 30 Dec 2025 12:08:32 +0100 Subject: [PATCH 9/9] pin syn version for mrsv --- CHECKLIST.md | 3 ++- Cargo.lock | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHECKLIST.md b/CHECKLIST.md index e54ec0d2..02a17d8b 100644 --- a/CHECKLIST.md +++ b/CHECKLIST.md @@ -12,7 +12,8 @@ - `cargo update --offline` # update sniprun's version in committed Cargo.lock But alas some packages must be downgraded to respect MSRV, see Cargo.toml and -add to the list if (when) necessary +add to the list if (when) necessary: +- cargo update -p syn@2.0.108 --precise 2.0.106 ## Merge process - create a PR dev -> master diff --git a/Cargo.lock b/Cargo.lock index 722b712d..1b5cd566 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -856,9 +856,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.108" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote",