 		   (concat source "|"))
 		  ((listp source)
 		   (let ((temp-file (make-temp-file "sk")))
+		     (setq temp-input temp-file)
 		     (write-region (mapconcat 'identity source "\n") nil temp-file)
 		     (concat "cat " temp-file "|")))
 		  (t (throw 'sk/command "invalid source type")))))
     (let ((output-file (make-temp-file "sk")))
       `((command . ,(concat prefix sk/executable " " sk/args " " optstr " > " output-file))
+	(temp-input . ,temp-input)
 	(output-file . ,output-file)))))
 
 

  (let* ((commands (sk/command (if (not (listp opts)) '() opts)))
	 (command (alist-get 'command commands sk/executable))
	 (output-file (alist-get 'output-file commands)))
    (advice-add 'term-handle-exit :after (sk/wrap-after-term-handle-exit exit-handler output-file))
    (let ((buf (get-buffer-create "*SKIM*"))
	  (window-height (if sk/position-bottom (- sk/window-height) sk/window-height)))
      (split-window-vertically window-height)

      (if lines lines '()))))

(defun sk/command (opts)
  (let* ((temp-input nil)
	 (optstr (alist-get 'option opts ""))
	 (interactive? (alist-get 'interactive opts nil))
	 (source (alist-get 'source opts))
	 (source (cond
		  ((and (not source) (getenv "SKIM_DEFAULT_COMMAND"))
		   (let ((temp-file (make-temp-file "sk")))
		     ;; append the default command
		     (setq temp-input temp-file)
		     (write-region (getenv "SKIM_DEFAULT_COMMAND") nil temp-file)
		     (concat "sh " temp-file " 2>/dev/null")))
		  ((and source (stringp) (string= source "none"))
