code: def call_wine_cmd_once(wine, cmd, env, mode):
      p = run_subprocess(
          wine + cmd,
          stdout=subprocess.PIPE,
          stderr=subprocess.STDOUT,
          env=env,
          close_fds=True,
          shell=False,
      )
  
      output = find_cmd_out(cmd)
      error = None
      if output is not None and os.path.exists(output):
          try:
              os.remove(output)
          except OSError as e:
              if e.errno != errno.ENOENT:
                  error = e
          except Exception as e:
              error = e
  
      if error is not None:
          print >> sys.stderr, "Output {} already exists and we have failed to remove it: {}".format(
              output, error
          )
  
      # print >>sys.stderr, cmd, env, wine
  
      stdout_and_stderr, _ = p.communicate()
  
      return_code = p.returncode
      if not stdout_and_stderr:
          if return_code != 0:
              raise Exception("wine did something strange")
  
          return return_code
      elif " : fatal error " in stdout_and_stderr:
          return_code = 1
      elif " : error " in stdout_and_stderr:
          return_code = 2
  
      lines = [x.strip() for x in stdout_and_stderr.split("\n")]
  
      prefixes = [
          "Microsoft (R)",
          "Copyright (C)",
          "Application tried to create a window",
          "The graphics driver is missing",
          "Could not load wine-gecko",
          "wine: configuration in",
          "wine: created the configuration directory",
          "libpng warning:",
      ]
  
      suffixes = [
          ".c",
          ".cxx",
          ".cc",
          ".cpp",
          ".masm",
      ]
  
      substrs = [
          "Creating library Z:",
          "err:heap",
          "err:menubuilder:",
          "err:msvcrt",
          "err:ole:",
          "err:wincodecs:",
          "err:winediag:",
      ]
  
      def good_line(l):
          for x in prefixes:
              if l.startswith(x):
                  return False
  
          for x in suffixes:
              if l.endswith(x):
                  return False
  
          for x in substrs:
              if x in l:
                  return False
  
          return True
  
      def filter_lines():
          for l in lines:
              if good_line(l):
                  yield subst_path(l.strip())
  
      stdout_and_stderr = "\n".join(filter_lines()).strip()
  
      if stdout_and_stderr:
          print >> sys.stderr, stdout_and_stderr
  
      return return_code
  
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 7 for calling a global function with example usage: call_wine_cmd_once(wine, cmd, env, mode) and returns: return_code, return_code, True, False, False, False