[英]How to debug with VSCode and pipe command
I am using VScode and I would like to debug a program that is used with a pipe command.我正在使用 VScode,我想调试一个与管道命令一起使用的程序。
In the console, I run my program with在控制台中,我运行我的程序
cat dataset.txt | python my_program.py
How can I configure VSCode to pass the cat
command so I can debug the program correctly?如何配置 VSCode 以传递
cat
命令,以便正确调试程序?
I suspect I need to edit launch.json
?我怀疑我需要编辑
launch.json
吗?
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
If you change "console" to "externalTerminal", when you run the program an external terminal window will open.如果将“控制台”更改为“externalTerminal”,则在运行程序时将打开一个外部终端窗口。 This window has stdin connected to the keyboard, so if you type or paste content it will be passed to the program until you send or type ctrl-z.
此窗口已连接到键盘的标准输入,因此如果您键入或粘贴内容,它将被传递到程序,直到您发送或键入 ctrl-z。 stdout goes to the window.
标准输出进入窗口。 Debugging and breakpoints work as expected.
调试和断点按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.