weixin_39639686
2020-11-25 11:31 阅读 6

Tty detection

This PR makes two changes: use golang.org/x/crypto/ssh/terminal to detect if we're running in a tty, and changes the non-tty logic to loop forever when loops is set to 0.

该提问来源于开源项目:jmhobbs/terminal-parrot

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • weixin_39639686 weixin_39639686 2020-11-25 11:31

    Related: telnet ada.csh.rit.edu. I'm working on adding a parrot cname but our machine management software is currently upset with me.

    点赞 评论 复制链接分享
  • weixin_39860732 weixin_39860732 2020-11-25 11:31

    The telnet thing is awesome!

    So, the code for IsTerminal was straight from that package, but I'd rather not drag in the whole thing. Is there a good reason to bring it in?

    点赞 评论 复制链接分享
  • weixin_39639686 weixin_39639686 2020-11-25 11:31

    Why not bring in the package? And the package has implementations for linux, bsd, plan9, and windows. You only pulled in one of the implementations, which I'm assuming wasn't the linux implementation since I wasn't able to build it. See here for the different implementations.

    点赞 评论 复制链接分享
  • weixin_39860732 weixin_39860732 2020-11-25 11:31

    I guess I'm just used to bringing in the absolute minimum in dependencies, and a whole crypto library for some terminal detection seems excessive. The multiple implementations is a valid point though.

    点赞 评论 复制链接分享
  • weixin_39639686 weixin_39639686 2020-11-25 11:31

    Cleaning up old PRs of mine. If you're interested in this still feel free to steal my commits and change them as you see fit.

    点赞 评论 复制链接分享

相关推荐