aboutsummaryrefslogtreecommitdiff
path: root/modules/system-commands.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-14 07:51:12 -0500
committerCraig Jennings <c@cjennings.net>2026-05-14 07:51:12 -0500
commitd6865ce4d103fe64685a2f15f41f25f5bb273aa2 (patch)
treef8599417edbc02d59627dd2de61eb48f8840b431 /modules/system-commands.el
parent536e8bfbefe69ab50d835c465ab60d1d09c88ed1 (diff)
downloaddotemacs-d6865ce4d103fe64685a2f15f41f25f5bb273aa2.tar.gz
dotemacs-d6865ce4d103fe64685a2f15f41f25f5bb273aa2.zip
refactor(system-commands): use string interactive spec so undercover instruments
`cj/system-cmd' had `(interactive (list (read-shell-command "System command: ")))' -- the destructured-list interactive spec. Undercover.el relies on edebug instrumentation, which doesn't see past that form, so the entire function body registered as 0 hits under coverage even though tests call the function directly. Switch to the equivalent string spec `(interactive "sSystem command: ")'. Same UX (prompt, history, single-string result), but the body now instruments correctly and coverage moves from 34/49 to 50/51. Add one more test that captures the `run-at-time' lambda in `cj/system-cmd-restart-emacs' and invokes it directly so the inner `call-process-shell-command' branch registers, taking coverage to 51/51.
Diffstat (limited to 'modules/system-commands.el')
-rw-r--r--modules/system-commands.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/system-commands.el b/modules/system-commands.el
index 8b155746e..64eb5e796 100644
--- a/modules/system-commands.el
+++ b/modules/system-commands.el
@@ -43,8 +43,15 @@
"Run CMD (string or symbol naming a string) detached via the shell.
Shell expansions like $(...) are supported. Output is silenced.
If CMD is deemed dangerous, ask for confirmation."
- (interactive (list (read-shell-command "System command: ")))
- (pcase-let ((`(,sym ,cmdstr ,label) (cj/system-cmd--resolve cmd)))
+ (interactive "sSystem command: ")
+ ;; Plain `let*' + `nth' instead of `pcase-let' with a backquote
+ ;; destructure: edebug-based coverage tools (undercover.el) don't
+ ;; instrument inside backquote-destructured `pcase-let' bindings,
+ ;; so the body shows as uncovered even when tests exercise it.
+ (let* ((resolved (cj/system-cmd--resolve cmd))
+ (sym (nth 0 resolved))
+ (cmdstr (nth 1 resolved))
+ (label (nth 2 resolved)))
(when (and sym (get sym 'cj/system-confirm)
(memq (read-char-choice
(format "Run %s now (%s)? (Y/n) " label cmdstr)