[英]How can I debug sub-process in vscode?
I am using execa
to spawn a sub-process in index.js, but I can't debug the spawned file(log_ok.js).我正在使用
execa
在 index.js 中生成一个子进程,但我无法调试生成的文件(log_ok.js)。 this is the code, does anyone know how to debug it?这是代码,有人知道如何调试吗?
index.js index.js
const execa = require('execa');
execa('node', ['./log_ok.js'], { stdio: 'inherit' })
and my launch.json:和我的launch.json:
{
"type": "node",
"request": "launch",
"name": "debug",
"program": "${workspaceFolder}/index.js",
"autoAttachChildProcesses": true
}
./log_ok.js ./log_ok.js
console.log('ok')
you maybe try a "attach" request (see https://code.visualstudio.com/Docs/editor/debugging#_launch-versus-attach-configurations ), and execa the sub process with an inspect port您可以尝试“附加”请求(请参阅https://code.visualstudio.com/Docs/editor/debugging#_launch-versus-attach-configurations ),并使用检查端口执行子进程
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.