首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >终端将被任务重用,按任意键关闭它。

终端将被任务重用,按任意键关闭它。
EN

Stack Overflow用户
提问于 2020-11-24 22:45:23
回答 1查看 1.6K关注 0票数 1

我正在使用mac BigSur上的vscode学习C++。终端始终打印“终端将被任务重用,按任意键关闭它。”在尝试添加带有属性的“演示文稿”之后:“新建”。这个问题还在发生。

这是我的task.json

代码语言:javascript
运行
复制
{
"tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++: g++ build active file",
        "command": "/usr/bin/g++",
        "args": [
            "-g",
            "${file}",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}"
        ],
        "options": {
            "cwd": "/usr/bin"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "presentation": {
            "echo": true,
            "reveal": "always",
            "focus": true,
            "panel": "new"
        },
        "detail": "Generated task by Debugger"
    }
],
"version": "2.0.0"}

这是我的launch.json

代码语言:javascript
运行
复制
{

"version": "0.2.0",
"configurations": [
    {
        "name": "g++ - Build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "lldb",
        "preLaunchTask": "C/C++: g++ build active file"
    }
]}

EN

回答 1

Stack Overflow用户

发布于 2022-07-28 11:24:18

可以通过在“表示”块中添加属性"Terminal will be reused by tasks, press any key to close it."来避免消息"showReuseMessage": false

代码语言:javascript
运行
复制
"presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new",
        "showReuseMessage": false
    },

但是,我们仍然需要按enter键才能返回命令提示符。为了避免按enter键,还应该在"presentation“块中添加另一个属性"close": true

代码语言:javascript
运行
复制
"presentation": {
        "echo": true,
        "reveal": "always",
        "focus": true,
        "panel": "new",
        "showReuseMessage": false,
        "close": true
    },

我在上面的Visual代码版本1.68.0中测试了Windows 10,64位平台。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64995957

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档