   "Kill lean-server process. Return t if killed, nil if nothing to kill"
   (interactive)
   (cond
-   ((and lean-global-server-process (process-exit-status lean-global-server-process))
+   ((and lean-global-server-process
+         (not (= 0 (process-exit-status lean-global-server-process))))
     (setq lean-global-server-process nil)
     t)
    (lean-global-server-process

  "Filter function attached to lean-server process"
  (lean-server-process-received-message (process-buffer process) string))

;; How to create an async process
;; ==============================
(defun lean-server-create-process ()
  "Create lean-server process."
  ;; (when (buffer-modified-p)

                        lean-server-option)))
    (set-process-coding-system lean-server-process 'utf-8 'utf-8)
    (set-process-filter lean-server-process 'lean-server-output-filter)
    (set-process-sentinel lean-server-process 'lean-server-handle-signal)
    (lean-server-initialize-global-vars)
    (setq lean-global-server-process lean-server-process)
    lean-server-process))

