Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lua/livepreview/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ function M.isWindows()
return vim.uv.os_uname().version:match("Windows")
end

---@type pwsh|powershell
local powershell_cmd = vim.fn.executable("pwsh") == 1 and "pwsh"
or "powershell"
Comment thread
brianhuster marked this conversation as resolved.

--- Execute a shell commands
---@async
---@param cmd string: terminal command to execute. Term_cmd will use sh or pwsh depending on the OS
Expand All @@ -136,7 +140,7 @@ end
function M.term_cmd(cmd, callback)
local shell = "sh"
if M.isWindows() then
shell = "pwsh"
shell = powershell_cmd
end

local on_exit = function(result)
Expand All @@ -158,7 +162,7 @@ end
function M.await_term_cmd(cmd)
local shell = "sh"
if M.isWindows() then
shell = "pwsh"
shell = powershell_cmd
end
local results = vim.system({ shell, "-c", cmd }, { text = true }):wait()
return results
Expand Down