Skip to content

Commit a36f50c

Browse files
authored
fix: runner cmd #241 (#329)
The `Run` class always uses the command passed during the initialization, so the profile config changes don't apply.
1 parent 905013e commit a36f50c

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lua/java/runner/run.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,16 @@ local notify = require('java-core.utils.notify')
77
---@field buffer number
88
---@field is_running boolean
99
---@field is_manually_stoped boolean
10-
---@field private cmd string
1110
---@field private term_chan_id number
1211
---@field private job_chan_id number | nil
1312
---@field private is_failure boolean
1413
local Run = class()
1514

1615
---@param dap_config java-dap.DapLauncherConfig
1716
---@param cmd string[]
18-
function Run:_init(dap_config, cmd)
17+
function Run:_init(dap_config)
1918
self.name = dap_config.name
2019
self.main_class = dap_config.mainClass
21-
self.cmd = table.concat(cmd, ' ')
2220
self.buffer = vim.api.nvim_create_buf(false, true)
2321
self.term_chan_id = vim.api.nvim_open_term(self.buffer, {
2422
on_input = function(_, _, _, data)
@@ -27,11 +25,13 @@ function Run:_init(dap_config, cmd)
2725
})
2826
end
2927

30-
function Run:start()
28+
---@param cmd string[]
29+
function Run:start(cmd)
30+
local merged_cmd = table.concat(cmd, ' ')
3131
self.is_running = true
32-
self:send_term(self.cmd)
32+
self:send_term(merged_cmd)
3333

34-
self.job_chan_id = vim.fn.jobstart(self.cmd, {
34+
self.job_chan_id = vim.fn.jobstart(merged_cmd, {
3535
pty = true,
3636
on_stdout = function(_, data)
3737
self:send_term(data)

lua/java/runner/runner.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function Runner:start_run(args)
4141
self.curr_run = run
4242
self.logger:set_buffer(run.buffer)
4343

44-
run:start()
44+
run:start(cmd)
4545
end
4646

4747
---Stops the user selected run

0 commit comments

Comments
 (0)