Hi, everyone!
How can I redirect this output data (while debugging) to my extension?
@mike-prokaziuk I don't understand what you mean.
I develop an extension for VS Code.
I launch child process by using 'spawn' command and attach to him. In this case I can subscribe to 'cp' events and receive data.
But, I wanted to try launch this process using VS Code capabilities and 'launch.json' file.
The process has started and the VS Code has attached to them, but I don't understand how to receive the data from him :) .
The 'process' is simple console app.
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"args": [
"<",
"in.txt"
]
}
No effect. File is not redirecting.
I updated python to 3.7.2 and it started working!
This simple "docs addition" is open for 2 years...
And currently I'm unable to make this work.
This is my launch configuration:
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/myapp.dll",
"args": ["<", "/Users/guyarad/src/input.txt"],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false
}
Any ideas?
The Pino logger recommends piping the output to a "prettifier" when developing, it avoids the use of including dev libraries in code.
@gregvanl here is what we could say:
"Redirect input/output from/to the debug target"
Redirecting input/output is debugger/runtime specific, so VS Code does not have a built-in solution that works for all debuggers.
Here are two approaches you might want to consider:
{
"name": "launch program that reads a file from stdin",
"type": "node",
"request": "launch",
"program": "program.js",
"console": "integratedTerminal",
"args": [
"<",
"in.txt"
]
}
Any clue on how to do the same thing in powershell ? I need to add Get-Content <file> | .. before my command
Most helpful comment
@gregvanl here is what we could say:
"Redirect input/output from/to the debug target"
Redirecting input/output is debugger/runtime specific, so VS Code does not have a built-in solution that works for all debuggers.
Here are two approaches you might want to consider:
{ "name": "launch program that reads a file from stdin", "type": "node", "request": "launch", "program": "program.js", "console": "integratedTerminal", "args": [ "<", "in.txt" ] }This approach requires that the "<" syntax survives the debugger extension and ends up unmodified in the integrated terminal.