From 5f94fd7697d1cf1b8704827a351dc7ef61d35c18 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Sun, 29 Oct 2023 21:35:59 +0100 Subject: [PATCH] fix(dap/quickfix): set `cwd` in shell command --- CHANGELOG.md | 5 +++++ lua/rustaceanvim/compat.lua | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c6e4dc5..2a46652e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.2.1] - 2023-10-29 + +### Fixed +- `dap`/`quickfix` executor: Fix setting `cwd` for shell commands. + ## [3.2.0] - 2023-10-29 ### Added diff --git a/lua/rustaceanvim/compat.lua b/lua/rustaceanvim/compat.lua index abf14b3a..89596003 100644 --- a/lua/rustaceanvim/compat.lua +++ b/lua/rustaceanvim/compat.lua @@ -19,7 +19,13 @@ M.uv = vim.uv or vim.loop M.system = vim.system -- wrapper around vim.fn.system to give it a similar API to vim.system - or function(cmd, _, on_exit) + or function(cmd, opts, on_exit) + if opts.cwd then + local shell = require('rustaceanvim.shell') + cmd = shell.chain_commands { 'cd ' .. opts.cwd, table.concat(cmd, ' ') } + ---@cast cmd string + end + local output = vim.fn.system(cmd) local ok = vim.v.shell_error ---@type vim.SystemCompleted