presubmit: Add dirmd_bin to CheckDirMetadataFormat.

dirmd is not available on bots, so we'll need to receive the path
where it's available as an argument.

Bug: 1102997
Change-Id: I8966225d8ded3eb06c504797280baaa6c6c64a9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2321510
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py
index 5717727..59a3238 100644
--- a/presubmit_canned_checks.py
+++ b/presubmit_canned_checks.py
@@ -1028,7 +1028,7 @@
   return []
 
 
-def CheckDirMetadataFormat(input_api, output_api):
+def CheckDirMetadataFormat(input_api, output_api, dirmd_bin=None):
   # TODO(crbug.com/1102997): Remove OWNERS once DIR_METADATA migration is
   # complete.
   file_filter = lambda f: (
@@ -1042,13 +1042,12 @@
     return []
 
   name = 'Validate metadata in OWNERS and DIR_METADATA files'
-  dirmd_bin = 'dirmd.bat' if input_api.is_windows else 'dirmd'
   kwargs = {}
-  if input_api.is_windows:
-    # Needed to be able to resolve 'dirmd.bat'.
-    kwargs['shell'] = True
 
+  if dirmd_bin is None:
+    dirmd_bin = 'dirmd.bat' if input_api.is_windows else 'dirmd'
   cmd = [dirmd_bin, 'validate'] + sorted(affected_files)
+
   return [input_api.Command(
       name, cmd, kwargs, output_api.PresubmitError)]