From d32dacba93752dc462a70ed9df996f4ea9f7a190 Mon Sep 17 00:00:00 2001 From: tamarrow Date: Fri, 26 Aug 2016 09:37:50 -0700 Subject: [PATCH] fix issue on windows where we move an open file (#742) --- dcos/subcommand.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dcos/subcommand.py b/dcos/subcommand.py index 6faed14..46c2e33 100644 --- a/dcos/subcommand.py +++ b/dcos/subcommand.py @@ -493,8 +493,13 @@ def _install_with_binary( if kind == "executable": util.ensure_dir_exists(env_bin_dir) binary_name = "dcos-{}".format(package_name) + if util.is_windows_platform(): + binary_name += '.exe' binary_file = os.path.join(env_bin_dir, binary_name) - shutil.move(binary_tmp, binary_file) + + # copy to avoid windows error of moving open file + # binary_tmp will be removed by context manager + shutil.copy(binary_tmp, binary_file) else: # kind == "zip" with zipfile.ZipFile(binary_tmp) as zf: