code: def run_main():
      parser = argparse.ArgumentParser()
      parser.add_argument("wine", action="store")
      parser.add_argument(
          "-v", action="store", dest="version", default="120"
      )
      parser.add_argument("-I", action="append", dest="incl_paths")
      parser.add_argument("mode", action="store")
      parser.add_argument("arcadia_root", action="store")
      parser.add_argument("arcadia_build_root", action="store")
      parser.add_argument("binary", action="store")
      parser.add_argument("free_args", nargs=argparse.REMAINDER)
      # By now just unpack. Ideally we should fix path and pack arguments back into command file
      args = parser.parse_args()
  
      wine = args.wine
      mode = args.mode
      binary = args.binary
      version = args.version
      incl_paths = args.incl_paths
      bld_root = args.arcadia_build_root
      free_args = args.free_args
  
      wine_dir = os.path.dirname(os.path.dirname(wine))
      bin_dir = os.path.dirname(binary)
      tc_dir = os.path.dirname(
          os.path.dirname(os.path.dirname(bin_dir))
      )
      if not incl_paths:
          incl_paths = [tc_dir + "/VC/include", tc_dir + "/include"]
  
      cmd_out = find_cmd_out(free_args)
  
      env = os.environ.copy()
  
      env.pop("DISPLAY", None)
  
      env["WINEDLLOVERRIDES"] = "msvcr{}=n".format(version)
      env["WINEDEBUG"] = "fixme-all"
      env["INCLUDE"] = ";".join(fix_path(p) for p in incl_paths)
      env["VSINSTALLDIR"] = fix_path(tc_dir)
      env["VCINSTALLDIR"] = fix_path(tc_dir + "/VC")
      env["WindowsSdkDir"] = fix_path(tc_dir)
      env["LIBPATH"] = fix_path(tc_dir + "/VC/lib/amd64")
      env["LIB"] = fix_path(tc_dir + "/VC/lib/amd64")
      env["LD_LIBRARY_PATH"] = ":".join(
          wine_dir + d for d in ["/lib", "/lib64", "/lib64/wine"]
      )
  
      cmd = [binary] + process_free_args(
          free_args, wine, bld_root, mode
      )
  
      for x in ("/NOLOGO", "/nologo", "/FD"):
          try:
              cmd.remove(x)
          except ValueError:
              pass
  
      def run_process(sleep, tout):
          if sleep:
              time.sleep(sleep)
  
          args = {"cmd": cmd, "env": env, "mode": mode, "tout": tout}
  
          slave_cmd = [
              sys.executable,
              sys.argv[0],
              wine,
              "slave",
              json.dumps(args),
          ]
          p = run_subprocess(
              slave_cmd,
              stderr=subprocess.STDOUT,
              stdout=subprocess.PIPE,
              shell=False,
          )
          out, _ = p.communicate()
          return p.wait(), out
  
      def print_err_log(log):
          if not log:
              return
          if mode == "cxx":
              log = colorize(log)
          print >> sys.stderr, log
  
      tout = 200
  
      while True:
          rc, out = run_process(0, tout)
  
          if rc in (-signal.SIGALRM, signal.SIGALRM):
              print_err_log(out)
              print >> sys.stderr, "##append_tag##time out"
          elif out and " stack overflow " in out:
              print >> sys.stderr, "##append_tag##stack overflow"
          elif out and "recvmsg: Connection reset by peer" in out:
              print >> sys.stderr, "##append_tag##wine gone"
          elif out and "D8037" in out:
              print >> sys.stderr, "##append_tag##repair wine"
  
              try:
                  os.unlink(
                      os.path.join(
                          os.environ["WINEPREFIX"], ".update-timestamp"
                      )
                  )
              except Exception as e:
                  print >> sys.stderr, e
  
          else:
              print_err_log(out)
  
              # non-zero return code - bad, return it immediately
              if rc:
                  print >> sys.stderr, "##win_cmd##" + " ".join(cmd)
                  print >> sys.stderr, "##args##" + " ".join(free_args)
                  return rc
  
              # check for output existence(if we expect it!) and real length
              if cmd_out:
                  if is_good_file(cmd_out):
                      return 0
                  else:
                      # retry!
                      print >> sys.stderr, "##append_tag##no output"
              else:
                  return 0
  
          tout *= 3
  
imports: import sys
  import os
  import re
  import subprocess
  import signal
  import time
  import json
  import argparse
  import errno
  import process_command_files
  import process_whole_archive_option
label_desc: Use image node_id 21 for calling a global function with example usage: run_main() and returns: p,  out, rc, int, int