Actually no, it doesn't help in all cases. It got better, but sometimes still dies with the same error:
Debugger entered--Lisp error: (wrong-type-argument processp nil)
process-mark(nil)
(move-marker (process-mark proc) (point) (current-buffer))
(let ((proc (get-buffer-process (current-buffer)))) (message "@ %S %S" (current-buffer) proc) (move-marker (process-mark proc) (point) (current-buffer)) (set-process-filter proc #'find-dired-filter) (set-process-sentinel proc #'find-dired-sentinel))
...
For debugging I also added this line:
(shell-command (concat command "&") (current-buffer))
(let ((proc (get-buffer-process (current-buffer))))
+ (message "@ %S %S" (current-buffer) proc)
;; Initialize the process marker; it is used by the filter.
(move-marker (process-mark proc) (point) (current-buffer)) ;; <-- dies here
Here is the resut in buffer *Messages*:
@ #<buffer *Find*> nil
So, the process can be nil immediately after `shell-command' returns too.
Paul