Disable echoing CMD code in copy_directory and copy_file rules on Windows

This commit is contained in:
Zvonimir Pervan 2022-09-01 13:13:39 +02:00
parent 61d9c62833
commit ff1ad48eb7
2 changed files with 11 additions and 7 deletions

View File

@ -34,6 +34,7 @@ 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 = """\
@ECHO OFF
if not exist \"{src}\\\" (
echo Error: \"{src}\" is not a directory
@exit 1

View File

@ -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("/", "\\"),
),