我有一个名为“runme”的Go二进制文件,它成功运行如下:./runme encrypt --password=password < plaintext.txt > encrypted.txt它成功地读取了一个名为“明文.txt”的文件,并输出一个名为“加密.txt”的加密文件。现在我想使用Dlv调试器进行Go调试,如下所示:dlv exec ./runme -- encrypt -password=password < plaintext.txt > encrypted.txt但是,我从dlv调试器收到以下错误消息:Stdin is not a terminal, use '-r' to specify redirects for the target process or --allow-non-terminal-interactive=true if you really want to specify a redirect for Delve所以我再次尝试略有不同:dlv exec -r ./runme -- encrypt -password=password < plaintext.txt > encrypted.txt但是我得到了上面显示的完全相同的错误消息。然后我尝试以下操作:dlv exec --allow-non-terminal-interactive=true ./runme -- encrypt -password=password < plaintext.txt > encrypted.txt这次我收到一条不同的错误消息:Command failed: command not available这似乎是一件简单的事情,我无法在调试器中完成。我可能做错了什么?
1 回答

繁星点点滴滴
TA贡献1803条经验 获得超3个赞
我能够弄清楚。
解决方案是:
dlv exec -r stdin:plaintext.txt -r stdout:encrypted.txt ./runme -- encrypt -password=password
- 1 回答
- 0 关注
- 99 浏览
添加回答
举报
0/150
提交
取消