Disable echoing CMD code in copy_directory and copy_file rules on Windows
This commit is contained in:
parent
61d9c62833
commit
ff1ad48eb7
|
@ -34,12 +34,13 @@ def _copy_cmd(ctx, src, dst):
|
||||||
# https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy
|
# 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
|
# NB: robocopy return non-zero exit codes on success so we must exit 0 after calling it
|
||||||
cmd_tmpl = """\
|
cmd_tmpl = """\
|
||||||
if not exist \"{src}\\\" (
|
@ECHO OFF
|
||||||
echo Error: \"{src}\" is not a directory
|
if not exist \"{src}\\\" (
|
||||||
@exit 1
|
echo Error: \"{src}\" is not a directory
|
||||||
)
|
@exit 1
|
||||||
@robocopy \"{src}\" \"{dst}\" /E /MIR >NUL & @exit 0
|
)
|
||||||
"""
|
@robocopy \"{src}\" \"{dst}\" /E /MIR >NUL & @exit 0
|
||||||
|
"""
|
||||||
mnemonic = "CopyDirectory"
|
mnemonic = "CopyDirectory"
|
||||||
progress_message = "Copying directory %{input}"
|
progress_message = "Copying directory %{input}"
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,10 @@ def copy_cmd(ctx, src, dst):
|
||||||
output = bat,
|
output = bat,
|
||||||
# Do not use lib/shell.bzl's shell.quote() method, because that uses
|
# Do not use lib/shell.bzl's shell.quote() method, because that uses
|
||||||
# Bash quoting syntax, which is different from cmd.exe's syntax.
|
# 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("/", "\\"),
|
src.path.replace("/", "\\"),
|
||||||
dst.path.replace("/", "\\"),
|
dst.path.replace("/", "\\"),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue