mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-29 20:32:44 +08:00
fix: 终端 bug fix
This commit is contained in:
parent
ee2056521f
commit
a2a070d471
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# 快捷命令 V2.3.4
|
||||
# 快捷命令 V2.3.5
|
||||
|
||||
[](https://github.com/fofolee/uTools-quickcommand/stargazers) [](https://github.com/fofolee/uTools-quickcommand/network/members) [](https://github.com/fofolee/uTools-quickcommand/blob/master/LICENSE) [](https://github.com/fofolee/uTools-quickcommand/blob/master/src/helps/CHANGELOG.md) [](https://yuanliao.info/d/424) [](https://yuanliao.info/d/424) [](https://yuanliao.info/d/424)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# 快捷命令 V2.3.4
|
||||
# 快捷命令 V2.3.5
|
||||
|
||||
[](https://github.com/fofolee/uTools-quickcommand/stargazers) [](https://github.com/fofolee/uTools-quickcommand/network/members) [](https://github.com/fofolee/uTools-quickcommand/blob/master/LICENSE) [](https://github.com/fofolee/uTools-quickcommand/blob/master/src/helps/CHANGELOG.md) [](https://yuanliao.info/d/424) [](https://yuanliao.info/d/424) [](https://yuanliao.info/d/424)
|
||||
|
||||
|
@ -38,7 +38,7 @@ let oldVersionFix = () => {
|
||||
}
|
||||
|
||||
let showChangeLog = () => {
|
||||
let ignoreVersions = []
|
||||
let ignoreVersions = ['2.3.5']
|
||||
if (ignoreVersions.includes(pluginInfo().version)) return
|
||||
UTOOLS.putDB(pluginInfo().version, UTOOLS.DBPRE.CFG + 'version')
|
||||
utools.createBrowserWindow('./helps/CHANGELOG.html', { width: 1280, height: 920 })
|
||||
|
@ -4,7 +4,7 @@
|
||||
"main": "index.html",
|
||||
"homepage": "https://github.com/fofolee/uTools-quickcommand",
|
||||
"publishPage": "https://yuanliao.info/d/424",
|
||||
"version": "2.3.4",
|
||||
"version": "2.3.5",
|
||||
"author": "云之轩",
|
||||
"unpack":"autopep8.py",
|
||||
"logo": "logo.png",
|
||||
|
@ -389,13 +389,13 @@ if (process.platform == 'win32') quickcommand.runVbs = function (script) {
|
||||
|
||||
// 在终端中执行
|
||||
if (process.platform !== 'linux') quickcommand.runInTerminal = function (cmdline, dir) {
|
||||
let command = getCommandToLaunchTerminal(cmdline.replace(/"/g, `\\"`), dir)
|
||||
console.log(command);
|
||||
let command = getCommandToLaunchTerminal(cmdline, dir)
|
||||
child_process.exec(command)
|
||||
}
|
||||
|
||||
let getCommandToLaunchTerminal = (cmdline, dir) => {
|
||||
let cd = ''
|
||||
cmdline = cmdline.replace(/"/g, `\\"`)
|
||||
if (utools.isWindows()) {
|
||||
let wtpath = path.join(utools.getPath('home'), '/AppData/Local/Microsoft/WindowsApps/wt.exe')
|
||||
if (fs.existsSync(wtpath)) {
|
||||
@ -406,15 +406,9 @@ let getCommandToLaunchTerminal = (cmdline, dir) => {
|
||||
command = `${cd} start "" cmd /k "${cmdline}"`
|
||||
}
|
||||
} else {
|
||||
let iterm
|
||||
if (fs.existsSync('/Applications/iTerm 2.app')) {
|
||||
iterm = 'iTerm 2'
|
||||
} else if (fs.existsSync('/Applications/iTerm.app')) {
|
||||
iterm = 'iTerm'
|
||||
}
|
||||
if (dir) cd = `cd ${dir.replace(/ /g, `\\\\ `)} &&`
|
||||
if (iterm) {
|
||||
command = `osascript -e 'tell application "${iterm}"
|
||||
if (fs.existsSync('/Applications/iTerm.app')) {
|
||||
command = `osascript -e 'tell application "iTerm"
|
||||
create window with default profile
|
||||
tell current session of current window to write text "clear && ${cd} ${cmdline}"
|
||||
end tell'`
|
||||
@ -849,31 +843,6 @@ runCodeFile = (cmd, option, terminal, callback) => {
|
||||
}
|
||||
// 在终端中输出
|
||||
if (terminal) cmdline = getCommandToLaunchTerminal(cmdline)
|
||||
// if (terminal) {
|
||||
// if (utools.isWindows()) {
|
||||
// if (bin.slice(-7) == 'csc.exe' || bin == 'gcc') {
|
||||
// cmdline = cmdline.split("&&")
|
||||
// cmdline = cmdline[0] + "&& start cmd /k " + cmdline[1]
|
||||
// } else {
|
||||
// cmdline = `start cmd /k ${cmdline}`
|
||||
// }
|
||||
// } else if(utools.isMacOs()){
|
||||
// var appleScript = `if application "Terminal" is running then
|
||||
// tell application "Terminal"
|
||||
// do script "clear;${cmdline.replace(/"/g, `\\"`)}"
|
||||
// activate
|
||||
// end tell
|
||||
// else
|
||||
// tell application "Terminal"
|
||||
// do script "clear;${cmdline.replace(/"/g, `\\"`)}" in window 1
|
||||
// activate
|
||||
// end tell
|
||||
// end if`;
|
||||
// cmdline = `osascript -e '${appleScript}'`
|
||||
// } else {
|
||||
// return message('Linux 不支持在终端输出')
|
||||
// }
|
||||
// }
|
||||
child = child_process.spawn(cmdline, { encoding: 'buffer', shell: true })
|
||||
// var chunks = [],
|
||||
// err_chunks = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user