code: def _fix_process_args(
      args: Args, env: OsEnviron | None, kwargs
  ) -> tuple[Args, OsEnviron, logging.Logger, bool]:
      if not env:
          env = os.environ
  
      # Search in spoof path if necessary
      program = str(args[0])
  
      if sys.platform == "win32":
          # pylint: disable=import-outside-toplevel
          from ocrmypdf.subprocess._windows import fix_windows_args
  
          args = fix_windows_args(program, args, env)
  
      log.debug("Running: %s", args)
      process_log = log.getChild(os.path.basename(program))
      text = bool(kwargs.get("text", False))
  
      return args, env, process_log, text
  
imports: from __future__ import annotations
  import logging
  import os
  import re
  import sys
  from collections.abc import Mapping, Sequence
  from contextlib import suppress
  from pathlib import Path
  from subprocess import PIPE, STDOUT, CalledProcessError, CompletedProcess, Popen
  from subprocess import run
  from typing import Callable, Union
  from packaging.version import Version
  from ocrmypdf.exceptions import MissingDependencyError
label_desc: Use image node_id 3 for calling a global function with example usage: _fix_process_args(args, env, kwargs) and returns: args,  env,  process_log,  text