Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remote debugging with vscode, console.log works but stdout is suppressed

I have a typescript remote platform project, using visual studio code (V1.28.2) as IDE. Node.js is started on platform, using the command node --inspect=0.0.0.0:9229 --inspect-brk=0.0.0.0:9229 ... there.

In visual studio code the launch.json file defines an attach request:

{
    "version": "0.2.0",
    "configurations": [
         {
            "type": "node",
            "request": "attach",
            "name": "Launch on RPI",
            "sourceMaps": true,
            "smartStep": true,
            "stopOnEntry": false,
            "port": 9229,
            "address": "192.168.1.2",
            "restart": false,
            "localRoot": "${workspaceRoot}/",
            "remoteRoot": "/home/pi/remoteproject/"
       }
    ]
}

```

Everything is working fine (starting, debugging, ...). But there is one issue I cannot understand.

A call of console.log('Hello'); is written in the Debug console window of code.
A call of process.stdout.write('Hello\n'); is suppressed there.

If the program is started inside a shell on the remote platform, both statements are printed out.

What is the reason for this different behavior? How I can redirect stdout to to visual studio code Debug console (or terminal) window?

like image 952
Manfred Steiner Avatar asked Jan 01 '26 22:01

Manfred Steiner


1 Answers

It's just how they've setup the integrated terminal, you can enable stdout by adding the "outputCapture": "std" flag to the configuration

like image 98
MoreThanTom Avatar answered Jan 06 '26 01:01

MoreThanTom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!