Visual Studio代码launch.json runtimeArgs在参数中带有双引号

问题描述 投票:1回答:1

我正在使用'Debugger for Chrome'扩展程序运行Visual Studio Code来调试一些javascript。但是,我想在调试时运行一个进程外的pepper插件。

在Visual Studio Code之外,我们通过将以下命令行标志传递给chrome.exe(以及其他)来完成此操作:

--register-pepper-plugins="path_to_plugin";mime_type

注意:需要双引号

要通过Visual Studio代码将命令行参数传递给Chrome,我设置了一个launch.json,并添加了以下内容:

"runtimeArgs" : ["--register-pepper-plugins=\"path_to_plugin\";mime_type"]

我可以看到使用ProcessExplorer将我的runtimeArgs传递给Chrome,但转义字符\原封不动,因此chrome实际收到的是:

--register-pepper-plugins=\"path_to_plugin\";mime_type

而不是

--register-pepper-plugins="path_to_plugin";mime_type

如果我删除转义字符,我只会得到

--register_pepper_plugins=

因为第二个双引号与第一个匹配。

我在做一些令人眼花缭乱的明显错误吗?

json visual-studio-code
1个回答
0
投票

这样做的方法是使用反弹来逃避额外的报价,例如:

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Launch",
        "type": "go",
        "request": "launch",
        "mode": "exec",
        "remotePath": "",
        "port": 2345,
        "host": "127.0.0.1",
        "program": "C:\\Geth\\gs\\bin\\geth.exe",
        "env": {},
        "args": ["--datadir",
             "/tmp/eth/60/01" ,
            "--verbosity",
            "9",
            "--nodiscover", 
            "--bootnodes",
            "enode://c50f8c5a50b898ab66231754855c582548ce722311e73c5e664a563ff35d8bddb26c10c74c2ebe62c69c6c7ed00031ef3e2d7fd563ff77cff91775cd3f07e4c3@[::]:30301",  
            "--ipcdisable",
            "--port",
            "30303", 
            "--rpcport",
            "8101",
            "console 2"],
        "showLog": true
    }
]

}

© www.soinside.com 2019 - 2024. All rights reserved.