Skip to content

Commit c3cc3d4

Browse files
committed
Fix arguments handling in netcore test functions to properly use them with a directory.
1 parent 53dc976 commit c3cc3d4

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

dap-netcore.el

+15-13
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,18 @@ the function needs to examine, starting with FILE."
207207
(setcdr config-cell (plist-put config-plist :processId pid))
208208
(dap-debug (cdr config-cell))))
209209

210-
(defun dap-netcore-test-run (attach-buffer &optional args-string)
210+
(defun dap-netcore-test-run (attach-buffer &optional args-string directory)
211211
"Run .NET tests process to obtain PID to attach for debugging."
212212
(with-environment-variables (("VSTEST_HOST_DEBUG" "1"))
213-
(start-process "dap-netcore-attach-process"
214-
attach-buffer
215-
"dotnet"
216-
"test"
217-
"--verbosity=Quiet"
218-
(concat "" args-string))))
213+
(let ((args-list (append (list "dotnet"
214+
"test"
215+
"--configuration=Debug"
216+
"--verbosity=Quiet"
217+
"--nologo")
218+
(split-string-shell-command args-string))))
219+
(when directory
220+
(push directory args-list))
221+
(apply #'start-process "dap-netcore-attach-process" attach-buffer args-list))))
219222

220223
(defun dap-netcore-debug-tests-filter-pid (process output)
221224
"Custom filter to extract PID from the process output in real-time."
@@ -241,14 +244,14 @@ the function needs to examine, starting with FILE."
241244
;; Remove the filter to avoid further checks
242245
(set-process-filter process nil))))))))
243246

244-
(defun dap-netcore-debug-test-init (&optional args-string)
247+
(defun dap-netcore-debug-test-init (&optional args-string directory)
245248
"Prepare .NET process to attach its PID for debugging."
246249
(let ((attach-buffer "*dap-netcore-attach*"))
247250
;; Kill existing buffer if it exists
248251
(when (get-buffer attach-buffer)
249252
(kill-buffer attach-buffer))
250253
;; Run dotnet process
251-
(let ((dotnet-process (dap-netcore-test-run attach-buffer args-string)))
254+
(let ((dotnet-process (dap-netcore-test-run attach-buffer args-string directory)))
252255
(when dotnet-process
253256
(set-process-filter dotnet-process #'dap-netcore-debug-tests-filter-pid)
254257
;; Set process finalization event
@@ -265,10 +268,9 @@ the function needs to examine, starting with FILE."
265268
(let ((params '())
266269
(filter (read-string "Filter: ")))
267270
(unless (string-empty-p filter)
268-
(push (concat params " --filter=" filter) params))
269-
(when directory
270-
(push directory params))
271-
(dap-netcore-debug-test-init (string-join (reverse params) " "))))
271+
(push (concat "--filter=" filter) params))
272+
(dap-netcore-debug-test-init (string-join params " ") directory)))
273+
272274

273275
(provide 'dap-netcore)
274276
;;; dap-netcore.el ends here

0 commit comments

Comments
 (0)