fix(shell-micropython): 系统命令不加引号,修复 Linux shell 解析错误
This commit is contained in:
@@ -10,9 +10,14 @@ export default class ShellMicroPython extends Shell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async burn(config) {
|
async burn(config) {
|
||||||
|
// 对系统命令(不含路径分隔符)不加引号,只对路径加引号
|
||||||
|
const pythonCmd = PYTHON.path.cli.includes('/') || PYTHON.path.cli.includes('\\')
|
||||||
|
? `"${PYTHON.path.cli}"`
|
||||||
|
: PYTHON.path.cli;
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
||||||
esptool: `"${PYTHON.path.cli}" "${MICROPYTHON.path.esptool}"`,
|
esptool: `${pythonCmd} "${MICROPYTHON.path.esptool}"`,
|
||||||
com: config.port,
|
com: config.port,
|
||||||
baudrate: config.baudrate || "460800"
|
baudrate: config.baudrate || "460800"
|
||||||
};
|
};
|
||||||
@@ -41,9 +46,14 @@ export default class ShellMicroPython extends Shell {
|
|||||||
}
|
}
|
||||||
console.log('Processed resetValue:', resetValue);
|
console.log('Processed resetValue:', resetValue);
|
||||||
|
|
||||||
|
// 对系统命令(不含路径分隔符)不加引号,只对路径加引号
|
||||||
|
const pythonCmd = PYTHON.path.cli.includes('/') || PYTHON.path.cli.includes('\\')
|
||||||
|
? `"${PYTHON.path.cli}"`
|
||||||
|
: PYTHON.path.cli;
|
||||||
|
|
||||||
const info = {
|
const info = {
|
||||||
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
indexPath: path.resolve(CLIENT_PATH, config.boardDirPath),
|
||||||
ampy: `"${PYTHON.path.cli}" "${MICROPYTHON.path.ampy}"`,
|
ampy: `${pythonCmd} "${MICROPYTHON.path.ampy}"`,
|
||||||
com: config.port,
|
com: config.port,
|
||||||
reset: resetValue
|
reset: resetValue
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user