mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-08 22:51:25 +08:00
ctrlC 终止命令
This commit is contained in:
parent
01276cb61b
commit
39444201a3
@ -61,6 +61,7 @@ export default {
|
|||||||
runResultStatus: true,
|
runResultStatus: true,
|
||||||
subInputValue: "",
|
subInputValue: "",
|
||||||
subInputListener: null,
|
subInputListener: null,
|
||||||
|
ctrlCListener: null,
|
||||||
quickcommandListener: null,
|
quickcommandListener: null,
|
||||||
history: [],
|
history: [],
|
||||||
historyIdx: null,
|
historyIdx: null,
|
||||||
@ -152,6 +153,15 @@ export default {
|
|||||||
: this.showRunResult(stdout, true);
|
: this.showRunResult(stdout, true);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
// ctrl c 终止
|
||||||
|
this.ctrlCListener = (e) => {
|
||||||
|
if (e.key === "c" && e.ctrlKey) {
|
||||||
|
quickcommand.kill(this.childProcess.pid);
|
||||||
|
quickcommand.showMessageBox("命令已终止");
|
||||||
|
document.removeEventListener("keydown", this.ctrlCListener);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
document.addEventListener("keydown", this.ctrlCListener);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 特殊变量赋值
|
// 特殊变量赋值
|
||||||
@ -260,9 +270,8 @@ export default {
|
|||||||
this.clear();
|
this.clear();
|
||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
if (!!this.childProcess) {
|
!!this.ctrlCListener &&
|
||||||
quickcommand.kill(this.childProcess.pid);
|
document.removeEventListener("keydown", this.ctrlCListener);
|
||||||
}
|
|
||||||
quickcommand.removeListener();
|
quickcommand.removeListener();
|
||||||
quickcommand.closeWaitButton();
|
quickcommand.closeWaitButton();
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user