title: Send commands to eshell from eslip
body: <p>I am writing an elisp function that sends a command to an existing eshell buffer, waits for the command to finish, and send another command.  For example, I would like to send:</p>
  
  <pre><code>python
  2+3
  </code></pre>
  
  <p>So far I have tried the following, unsuccessfully:</p>
  
  <p>1.Getting the eshell process to use <code>process-send-string</code> and <code>accept-process-output</code>:</p>
  
  <pre><code>(process-send-string eshell-proc "python")
  (accept-process-output eshell-proc 100)
  </code></pre>
  
  <p>But I have been unable to get the eshell process. <code>(get-buffer-process (current-buffer))</code> returns <code>nil</code> when the current buffer is eshell.</p>
  
  <p>2.Inserting the command in the buffer, using <code>(eshell-send-input)</code>, and sleeping for a bit before sending the next command:</p>
  
  <pre><code>(progn 
  (insert "python")
  (eshell-send-input)
  (sleep-for 1)
  (insert "2+3")
  (eshell-send-input))
  </code></pre>
  
  <p>The problem with this approach is that "2+3" gets sent before the python subprocess has been launched. This happens regardless of the amount of time for which I sleep. It seems that sleeping freezes all of emacs' subprocesses?</p>
  
  <p>3.Using <code>eshell-gather-process-output</code>:
  If I use either:</p>
  
  <pre><code>(eshell-gather-process-output "/usr/bin/python" nil)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>(eshell-gather-process-output "/usr/bin/python" (list "somearg"))
  </code></pre>
  
  <p>I get <code>Debugger entered--Lisp error: (wrong-type-argument arrayp nil)</code></p>
  
  <p>But if I use:</p>
  
  <pre><code>(eshell-gather-process-output "/usr/bin/python" (vector "somearg"))
  </code></pre>
  
  <p>I get <code>Debugger entered--Lisp error: (wrong-type-argument listp ["somearg"])</code></p>
  
  <p>So I am really confused as to what type of argument this command expects. I haven't been able to find a single example of usage of this command.</p>
  
  <p>Why does something so simple become so complicated? Thanks for any inputs</p>