File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -227,10 +227,12 @@ list of modules where missed IDENT was found."
227
227
228
228
(defun haskell-process-do-cabal (command )
229
229
" Run a Cabal command."
230
- (let ((process (haskell-interactive-process)))
230
+ (let ((process (ignore-errors
231
+ (haskell-interactive-process))))
231
232
(cond
232
- ((let ((child (haskell-process-process process)))
233
- (not (equal 'run (process-status child))))
233
+ ((or (eq process nil )
234
+ (let ((child (haskell-process-process process)))
235
+ (not (equal 'run (process-status child)))))
234
236
(message " Process is not running, so running directly. " )
235
237
(shell-command (concat " cabal " command)
236
238
(get-buffer-create " *haskell-process-log*" )
Original file line number Diff line number Diff line change 2
2
3
3
; ;; Code:
4
4
5
+ (require 'cl )
5
6
(require 'ert )
6
7
(require 'haskell-test-utils )
7
8
83
84
(search-forward " import Data.String" )
84
85
(haskell-goto-prev-error)
85
86
(should (looking-at-p " Data.Mayb" ))))
87
+
88
+ (ert-deftest do-cabal-no-process ()
89
+ " Ensure that haskell-process-do-cabal can call cabal directly.
90
+
91
+ Redefine `shell-command' to just capture the command it's asked
92
+ to execute, and make sure it matches what we expected."
93
+ (let (shell-call)
94
+ (flet ((shell-command (command &optional input-buffer output-buffer)
95
+ (setq shell-call command)))
96
+ (haskell-process-do-cabal " help" )
97
+ (should (equal shell-call " cabal help" )))))
You can’t perform that action at this time.
0 commit comments