Skip to content

Commit bfda5cc

Browse files
committed
fix: Server started after cmd error.
1 parent bd099b7 commit bfda5cc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lua/livepreview/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ end
3131
---@return boolean?
3232
function M.start(filepath, port)
3333
local processes = utils.processes_listening_on_port(port)
34-
if #processes > 0 then
34+
if #processes > 0 and process.status ~= 1 then
3535
for _, process in ipairs(processes) do
3636
if process.pid ~= vim.uv.os_getpid() then
3737
-- local kill_confirm = vim.fn.confirm(

lua/livepreview/utils.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,11 @@ function M.processes_listening_on_port(port)
295295
local cmd_result = M.await_term_cmd(cmd)
296296
if not cmd_result then
297297
print("Error getting processes listening on port " .. port)
298-
return {}
298+
return {status = 1}
299299
end
300300
if cmd_result.code ~= 0 then
301301
print("Error getting processes listening on port " .. port .. ": " .. cmd_result.stderr)
302-
return {}
302+
return {status = 1}
303303
end
304304
local cmd_stdout = cmd_result.stdout
305305
if not cmd_stdout or cmd_stdout == "" then

0 commit comments

Comments
 (0)