简体   繁体   中英

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). this is the code, does anyone know how to debug it?

index.js

const execa = require('execa');

execa('node', ['./log_ok.js'], { stdio: 'inherit' })

and my launch.json:

{
      "type": "node",
      "request": "launch",
      "name": "debug",
      "program": "${workspaceFolder}/index.js",
      "autoAttachChildProcesses": true
    }

./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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM