From cc2a2714c3831429fd0c64d234f984962e3e0e3f Mon Sep 17 00:00:00 2001 From: yczpf2019 Date: Sat, 24 Jan 2026 20:09:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(shell-micropython):=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E4=B8=8D=E5=8A=A0=E5=BC=95=E5=8F=B7=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Linux=20shell=20=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/shell-micropython.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/shell-micropython.js b/src/common/shell-micropython.js index 303ac0ac..349fff5d 100755 --- a/src/common/shell-micropython.js +++ b/src/common/shell-micropython.js @@ -10,9 +10,14 @@ export default class ShellMicroPython extends Shell { } async burn(config) { + // 对系统命令(不含路径分隔符)不加引号,只对路径加引号 + const pythonCmd = PYTHON.path.cli.includes('/') || PYTHON.path.cli.includes('\\') + ? `"${PYTHON.path.cli}"` + : PYTHON.path.cli; + const info = { indexPath: path.resolve(CLIENT_PATH, config.boardDirPath), - esptool: `"${PYTHON.path.cli}" "${MICROPYTHON.path.esptool}"`, + esptool: `${pythonCmd} "${MICROPYTHON.path.esptool}"`, com: config.port, baudrate: config.baudrate || "460800" }; @@ -41,9 +46,14 @@ export default class ShellMicroPython extends Shell { } console.log('Processed resetValue:', resetValue); + // 对系统命令(不含路径分隔符)不加引号,只对路径加引号 + const pythonCmd = PYTHON.path.cli.includes('/') || PYTHON.path.cli.includes('\\') + ? `"${PYTHON.path.cli}"` + : PYTHON.path.cli; + const info = { indexPath: path.resolve(CLIENT_PATH, config.boardDirPath), - ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`, + ampy: `${pythonCmd} "${MICROPYTHON.path.ampy}"`, com: config.port, reset: resetValue };