diff options
-rwxr-xr-x | tools/format.py | 2 | ||||
-rw-r--r-- | tools/util.py | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/tools/format.py b/tools/format.py index d1f555e5d..d1392df46 100755 --- a/tools/format.py +++ b/tools/format.py @@ -22,4 +22,4 @@ run([ # Do not format these. # js/msg_generated.ts # js/flatbuffers.js -run(["rustfmt", "--write-mode", "overwrite"] + glob("src/*.rs")) +run(["rustfmt", "-f", "--write-mode", "overwrite"] + glob("src/*.rs")) diff --git a/tools/util.py b/tools/util.py index 1d44acd48..40c98e336 100644 --- a/tools/util.py +++ b/tools/util.py @@ -7,12 +7,19 @@ import subprocess def run(args): print " ".join(args) env = os.environ.copy() + if os.name == "nt": + # Run through shell to make .bat/.cmd files work. + args = ["cmd", "/c"] + args subprocess.check_call(args, env=env) def remove_and_symlink(target, name, target_is_dir=False): try: - os.unlink(name) + # On Windows, directory symlink can only be removed with rmdir(). + if os.name == "nt" and os.path.isdir(name): + os.rmdir(name) + else: + os.unlink(name) except: pass symlink(target, name, target_is_dir) |