Skip to content

fix: runner cmd #241 #329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2024
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
12 changes: 6 additions & 6 deletions lua/java/runner/run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ local notify = require('java-core.utils.notify')
---@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
---@field private is_failure boolean
local Run = class()

---@param dap_config java-dap.DapLauncherConfig
---@param cmd string[]
function Run:_init(dap_config, cmd)
function Run:_init(dap_config)
self.name = dap_config.name
self.main_class = dap_config.mainClass
self.cmd = table.concat(cmd, ' ')
self.buffer = vim.api.nvim_create_buf(false, true)
self.term_chan_id = vim.api.nvim_open_term(self.buffer, {
on_input = function(_, _, _, data)
Expand All @@ -27,11 +25,13 @@ function Run:_init(dap_config, cmd)
})
end

function Run:start()
---@param cmd string[]
function Run:start(cmd)
local merged_cmd = table.concat(cmd, ' ')
self.is_running = true
self:send_term(self.cmd)
self:send_term(merged_cmd)

self.job_chan_id = vim.fn.jobstart(self.cmd, {
self.job_chan_id = vim.fn.jobstart(merged_cmd, {
pty = true,
on_stdout = function(_, data)
self:send_term(data)
Expand Down
2 changes: 1 addition & 1 deletion lua/java/runner/runner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Runner:start_run(args)
self.curr_run = run
self.logger:set_buffer(run.buffer)

run:start()
run:start(cmd)
end

---Stops the user selected run
Expand Down
Loading