From 90fce1b2afda0c7f7ef840a42b533a0c5a5c15a3 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Mon, 27 Nov 2023 19:10:34 +0100 Subject: [PATCH] mpremote: Fix edit command on windows. Signed-off-by: Jos Verlinde --- tools/mpremote/mpremote/commands.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/mpremote/mpremote/commands.py b/tools/mpremote/mpremote/commands.py index aae612765b..2e717ccc47 100644 --- a/tools/mpremote/mpremote/commands.py +++ b/tools/mpremote/mpremote/commands.py @@ -1,4 +1,5 @@ import os +import subprocess import sys import tempfile @@ -177,7 +178,8 @@ def do_edit(state, args): os.close(dest_fd) state.transport.fs_touch(src) state.transport.fs_get(src, dest, progress_callback=show_progress_bar) - if os.system('%s "%s"' % (os.getenv("EDITOR"), dest)) == 0: + cmd = f'{os.getenv("EDITOR")} "{dest}"' + if subprocess.run(cmd).returncode == 0: state.transport.fs_put(dest, src, progress_callback=show_progress_bar) finally: os.unlink(dest)