mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-24 13:03:30 +08:00
关闭窗口自动杀进程
This commit is contained in:
@@ -59,6 +59,7 @@ export default {
|
||||
history: [],
|
||||
historyIdx: null,
|
||||
enableHtml: false,
|
||||
child: null,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@@ -122,7 +123,7 @@ export default {
|
||||
: this.$root.programs[currentCommand.program];
|
||||
option.scptarg = currentCommand.scptarg || "";
|
||||
option.charset = currentCommand.charset || {};
|
||||
window.runCodeFile(
|
||||
this.child = window.runCodeFile(
|
||||
currentCommand.cmd,
|
||||
option,
|
||||
currentCommand.output === "terminal",
|
||||
@@ -237,6 +238,9 @@ export default {
|
||||
},
|
||||
stopRun() {
|
||||
this.runResult = "";
|
||||
if (!!this.child) {
|
||||
quickcommand.kill(this.child.pid);
|
||||
}
|
||||
if (!!this.listener) {
|
||||
this.subInputValue = "";
|
||||
utools.removeSubInput();
|
||||
|
@@ -256,11 +256,15 @@ interface quickcommandApi {
|
||||
loadRemoteScript(url: string): Promise<object>;
|
||||
|
||||
/**
|
||||
* 将 signal 发送给 pid 标识的进程 , 默认为关闭进程,同process.kill
|
||||
* 将 signal 发送给 pid 标识的进程 , 默认为关闭进程
|
||||
*
|
||||
* 不同于process.kill,会将该进程启用的所有子进程也杀死
|
||||
*
|
||||
* @param pid 进程 ID
|
||||
* @param signal 进程信号,默认为SIGTERM
|
||||
* @param callback 失败时的回调
|
||||
*/
|
||||
kill(pid: number, signal?: number | string): void;
|
||||
kill(pid: number, signal?: string | number, callback?: (error?: Error) => void): void;
|
||||
|
||||
/**
|
||||
* windows 下运行 VBS 脚本并返回运行结果
|
||||
|
Reference in New Issue
Block a user