Catching a direct redirect to /dev/tty

后端 未结 4 2178
抹茶落季
抹茶落季 2021-01-05 23:29

I\'m working on an application controller for a program that is spitting text directly to /dev/tty.

This is a production application controller that must be able to

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-05 23:57

    I can't quite determine whether the screen program mentioned by @flolo will do what you need or not. It may, but I'm not sure whether there is a logging facility built in, which appears to be what you need.

    There probably is a program out there already to do what you need. I'd nominate sudosh as a possibility.

    If you end up needing to write your own, you'll probably need to use a pseudo-tty (pty) and have your application controller sit in between the user's real terminal connection and the the pty device, where it can log whatever you need it to log. That's not trivial. You can find information about this in Rochkind's "Advanced UNIX Programming, 2nd Edn" book, and no doubt other similar books (Stevens' "Advanced Programming in the UNIX Environment" book is a likely candidate, but I don't have a copy to verify that).

提交回复
热议问题