class_docstr: Wraps ``subprocess.Popen`` with IOStream support.
  
  The constructor is the same as ``subprocess.Popen`` with the following
  additions:
  
  * ``stdin``, ``stdout``, and ``stderr`` may have the value
    ``tornado.process.Subprocess.STREAM``, which will make the corresponding
    attribute of the resulting Subprocess a `.PipeIOStream`.
  * A new keyword argument ``io_loop`` may be used to pass in an IOLoop.
  
  The ``Subprocess.STREAM`` option and the ``set_exit_callback`` and
  ``wait_for_exit`` methods do not work on Windows. There is
  therefore no reason to use this class instead of
  ``subprocess.Popen`` on that platform.
  
  .. versionchanged:: 4.1
     The ``io_loop`` argument is deprecated.
docstr: Returns a `.Future` which resolves when the process exits.
  
  Usage::
  
      ret = yield proc.wait_for_exit()
  
  This is a coroutine-friendly alternative to `set_exit_callback`
  (and a replacement for the blocking `subprocess.Popen.wait`).
  
  By default, raises `subprocess.CalledProcessError` if the process
  has a non-zero exit status. Use ``wait_for_exit(raise_error=False)``
  to suppress this behavior and return the exit status without raising.
  
  .. versionadded:: 4.2
docstr_tok: ["Returns","a","`",".Future","`","which","resolves","when","the","process","exits",".","Usage",":",":","ret","=","yield","proc.wait_for_exit","(",")","This","is","a","coroutine-friendly","alternative","to","`","set_exit_callback","`","(","and","a","replacement","for","the","blocking","`","subprocess.Popen.wait","`",")",".","By","default",",","raises","`","subprocess.CalledProcessError","`","if","the","process","has","a","non-zero","exit","status",".","Use","``","wait_for_exit","(","raise_error=False",")","``","to","suppress","this","behavior","and","return","the","exit","status","without","raising",".","..","versionadded",":",":","4.2"]
code: def wait_for_exit(self, raise_error=True):
      """Returns a `.Future` which resolves when the process exits.
  
      Usage::
  
          ret = yield proc.wait_for_exit()
  
      This is a coroutine-friendly alternative to `set_exit_callback`
      (and a replacement for the blocking `subprocess.Popen.wait`).
  
      By default, raises `subprocess.CalledProcessError` if the process
      has a non-zero exit status. Use ``wait_for_exit(raise_error=False)``
      to suppress this behavior and return the exit status without raising.
  
      .. versionadded:: 4.2
      """
      future = Future()
  
      def callback(ret):
          if ret != 0 and raise_error:
              # Unfortunately we don't have the original args any more.
              future.set_exception(CalledProcessError(ret, None))
          else:
              future.set_result(ret)
  
      self.set_exit_callback(callback)
      return future
  
imports: from __future__ import absolute_import, division, print_function
  import errno
  import os
  import signal
  import subprocess
  import sys
  import time
  from binascii import hexlify
  from tornado.concurrent import Future
  from tornado import ioloop
  from tornado.iostream import PipeIOStream
  from tornado.log import gen_log
  from tornado.platform.auto import set_close_exec
  from tornado import stack_context
  from tornado.util import errno_from_exception, PY3
label_desc: Use image node_id 3 for calling the Subprocess obj's underlying member method code with example usage: obj.wait_for_exit(raise_error) and returns: future