亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何調試采用輸入文件重定向和輸出文件重定向的 Go 二進制文件?

如何調試采用輸入文件重定向和輸出文件重定向的 Go 二進制文件?

Go
慕森卡 2022-10-04 17:21:30
我有一個名為“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



查看完整回答
反對 回復 2022-10-04
  • 1 回答
  • 0 關注
  • 88 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號