code: def run_tidy(task_queue, lock, timeout):
      watchdog = None
      while True:
          command = task_queue.get()
          try:
              proc = subprocess.Popen(
                  command,
                  stdout=subprocess.PIPE,
                  stderr=subprocess.PIPE,
              )
  
              if timeout is not None:
                  watchdog = threading.Timer(timeout, proc.kill)
                  watchdog.start()
  
              stdout, stderr = proc.communicate()
  
              with lock:
                  sys.stdout.write(stdout.decode("utf-8") + "\n")
                  sys.stdout.flush()
                  if stderr:
                      sys.stderr.write(stderr.decode("utf-8") + "\n")
                      sys.stderr.flush()
          except Exception as e:
              with lock:
                  sys.stderr.write(
                      "Failed: " + str(e) + ": ".join(command) + "\n"
                  )
          finally:
              with lock:
                  if timeout is not None and watchdog is not None:
                      if not watchdog.is_alive():
                          sys.stderr.write(
                              "Terminated by timeout: "
                              + " ".join(command)
                              + "\n"
                          )
                      watchdog.cancel()
              task_queue.task_done()
  
file_path: ray/ci/lint/clang-tidy-diff.py
imports: import argparse
  import glob
  import json
  import multiprocessing
  import os
  import re
  import shutil
  import subprocess
  import sys
  import tempfile
  import threading
  import traceback
  import queue
label_desc: Use image node_id 1 for calling a global function with example usage: run_tidy(task_queue, lock, timeout) without return types