From bba1a0d44aa3dd58bd0de53f37982ef270c7a176 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 11 Dec 2018 14:12:16 -0500 Subject: tools: remove_and_symlink can be skipped on unix This is more optimial and this fixes a problem where occasionally remove_and_symlink will error with: gen/compiler_bundle/main.js --sourcemapFile /Users/rld/src/deno --silent Traceback (most recent call last): File "../../tools/run_node.py", line 18, in util.remove_and_symlink(target_rel, "node_modules", True) File "/Users/rld/src/deno/tools/util.py", line 103, in remove_and_symlink symlink(target, name, target_is_dir) File "/Users/rld/src/deno/tools/util.py", line 141, in symlink os.symlink(target, name) OSError: [Errno 17] File exists --- tools/util.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/util.py') diff --git a/tools/util.py b/tools/util.py index b77f17282..368294f45 100644 --- a/tools/util.py +++ b/tools/util.py @@ -92,6 +92,8 @@ def green_ok(): def remove_and_symlink(target, name, target_is_dir=False): + if os.name != "nt" and os.path.islink(name): + return try: # On Windows, directory symlink can only be removed with rmdir(). if os.name == "nt" and os.path.isdir(name): -- cgit v1.2.3