Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lua/java/api/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function M.built_in.stop_app()
async(function()
M.runner:stop_run()
end)
.catch(get_error_handler('Failed to switch run'))
.catch(get_error_handler('Failed to stop run'))
.run()
end

Expand Down
5 changes: 4 additions & 1 deletion lua/java/runner/run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ local notify = require('java-core.utils.notify')
---@field main_class string
---@field buffer number
---@field is_running boolean
---@field is_manually_stoped boolean
---@field private cmd string
---@field private term_chan_id number
---@field private job_chan_id number | nil
Expand Down Expand Up @@ -46,6 +47,7 @@ function Run:stop()
return
end

self.is_manually_stoped = true
vim.fn.jobstop(self.job_chan_id)
vim.fn.jobwait({ self.job_chan_id }, 1000)
self.job_chan_id = nil
Expand Down Expand Up @@ -77,8 +79,9 @@ function Run:on_job_exit(exit_code)

self.is_running = false

if exit_code == 0 then
if exit_code == 0 or self.is_manually_stoped then
self.is_failure = false
self.is_manually_stoped = false
else
self.is_failure = true
notify.error(string.format('%s %s', self.name, message))
Expand Down