diff --git a/rules/private/copy_directory_private.bzl b/rules/private/copy_directory_private.bzl index da60c8b..cc518be 100644 --- a/rules/private/copy_directory_private.bzl +++ b/rules/private/copy_directory_private.bzl @@ -34,12 +34,13 @@ def _copy_cmd(ctx, src, dst): # https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy # NB: robocopy return non-zero exit codes on success so we must exit 0 after calling it cmd_tmpl = """\ -if not exist \"{src}\\\" ( - echo Error: \"{src}\" is not a directory - @exit 1 -) -@robocopy \"{src}\" \"{dst}\" /E /MIR >NUL & @exit 0 -""" + @ECHO OFF + if not exist \"{src}\\\" ( + echo Error: \"{src}\" is not a directory + @exit 1 + ) + @robocopy \"{src}\" \"{dst}\" /E /MIR >NUL & @exit 0 + """ mnemonic = "CopyDirectory" progress_message = "Copying directory %{input}" diff --git a/rules/private/copy_file_private.bzl b/rules/private/copy_file_private.bzl index 250418a..2d29d32 100644 --- a/rules/private/copy_file_private.bzl +++ b/rules/private/copy_file_private.bzl @@ -32,7 +32,10 @@ def copy_cmd(ctx, src, dst): output = bat, # Do not use lib/shell.bzl's shell.quote() method, because that uses # Bash quoting syntax, which is different from cmd.exe's syntax. - content = "@copy /Y \"%s\" \"%s\" >NUL" % ( + content = """\ + @ECHO OFF + @copy /Y \"%s\" \"%s\" >NUL + """ % ( src.path.replace("/", "\\"), dst.path.replace("/", "\\"), ),