gpt4 book ai didi

windows - 如何在Windows的package.json中的NPM脚本中关闭终端?

转载 作者:行者123 更新时间:2023-12-03 11:14:32 25 4
gpt4 key购买 nike

在我的 package.json 中,我具有使用“开始”(仅Windows OS)在新终端中打开的脚本:

"automation": "start npm run webdriver:start && npm run timeout"
"webdriver:start": "webdriver-manager start",
"timeout": "timeout 3",

我的问题是操作完成后如何关闭该终端窗口?

我已经尝试了以下操作,但是 都没有关闭终端窗口:
"automation": "(start npm run webdriver:start && npm run timeout) && exit"
"automation": "(start npm run webdriver:start && npm run timeout) && exit 1"

当我在Windows终端中仅执行“退出”时,它确实关闭了窗口,但是在脚本中似乎不起作用。
任何帮助深表感谢。

运行以下命令:
npm run automation

最佳答案

VSCode不允许从脚本关闭终端(请检查this issue),但是无论如何,您只能“沉默”新打开的终端,因为您必须通过向其中添加tasks.jsonrevealclear来修改showReuseMessage文件。它。

您的tasks.json文件应最终如下所示:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "automation",
"problemMatcher": [],
"presentation": {
"reveal": "silent",
"clear": true,
"showReuseMessage": false
}
}
]
}

如果您的 task.json文件丢失,请检查 this other question

关于windows - 如何在Windows的package.json中的NPM脚本中关闭终端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59887160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com