code: def _system_body(p):
      """Callback for _system."""
      enc = DEFAULT_ENCODING
  
      def stdout_read():
          for line in read_no_interrupt(p.stdout).splitlines():
              line = line.decode(enc, "replace")
              print(line, file=sys.stdout)
  
      def stderr_read():
          for line in read_no_interrupt(p.stderr).splitlines():
              line = line.decode(enc, "replace")
              print(line, file=sys.stderr)
  
      Thread(target=stdout_read).start()
      Thread(target=stderr_read).start()
  
      # Wait to finish for returncode. Unfortunately, Python has a bug where
      # wait() isn't interruptible (https://bugs.python.org/issue28168) so poll in
      # a loop instead of just doing `return p.wait()`.
      while True:
          result = p.poll()
          if result is None:
              time.sleep(0.01)
          else:
              return result
  
file_path: catboost/contrib/python/ipython/py3/IPython/utils/_process_win32.py
imports: import os
  import sys
  import ctypes
  import time
  from ctypes import c_int, POINTER
  from ctypes.wintypes import LPCWSTR, HLOCAL
  from subprocess import STDOUT, TimeoutExpired
  from threading import Thread
  from ._process_common import read_no_interrupt, process_handler, arg_split
  from .None import py3compat
  from .encoding import DEFAULT_ENCODING
label_desc: Use image node_id 1 for calling a global function with example usage: _system_body(p) and returns: result