4 ms·
Ispy: A python script for monitoring the output of other terminals and processes
- eugenekolo2 11y agoCan this work remotely? For remote screen showing.
- gouggoug 11y agoI doubt ipsy support remote screen sharing because it's a toy project that the author made to learn more about ptrace. Terminal multiplexers like screen or tmux might be more adapted for terminal sharing.
- d23 11y agoIt should work, but it'll slow down any process you're tracing. As you mentioned, screen works great for stuff that you have the foresight ahead of time to run in a screen session, such as a remote demo.
- jquast 11y agoYou can provide multiple viewers read-only access to session using a combination of ttyrec by the recorder, and ttyplay in streaming mode for incoming tcp connections. Perhaps using socat, inetd, systemd, etc: http://0xcc.net/ttyrec/index.html.en http://0xcc.net/ttyrec/index.html.en
- mistaken 11y agoWhy ptrace? Why not just take a peek from the stdout/stderr streams in /proc/$pid/fd?
- d23 11y agoI've tried this approach and haven't been successful. Mostly I just wanted to try ptrace. I got as far as trying to read the file descriptors and getting nothing back. I'd love to hear how to do it this way though, since it would probably be a lot more robust and performant. My email is in `setup.py` in the repo if you want to reach out.
- mistaken 11y agoFair enough. Simply reading from the file descriptor won't work since some of the output will be redirected to the original process depending on who reads the next character first. The solution is to attach to the process using ptrace and then reditrect the stdout using dup. There is an example on how to do this with gdb on stackoverflow (http://stackoverflow.com/questions/1323956/how-to-redirect-output-of-an-already-running-process http://stackoverflow.com/questions/1323956/how-to-redirect-o...) This would give a nice performance boost if you could implement this in your code.
- nathancahill 11y agoNeat. I wrote something similar using websockets for piping stdout/stderr to the web[0]. This is much lower level, I'll be reading the code to see if I can improve performance in PipeUp. [0] http://pipeup.io/tailnx#about http://pipeup.io/tailnx#about
- wnoise 11y agoI'm disappointed it's not is.py .
- teddyh 11y agoYou can’t have a library named using any Python reserved keyword. I mean, how would you import it? import is would be a syntax error, since “is” is the Python identity comparison operator.
- tedmiston 11y agoThis is interesting, but I'm not sure I understand the use case. Is Ispy intended as an alternative to, for example, running tail -f on a log file? Or for interactive programs where I might not have a log file?
- d23 11y agoHonestly, in the past I've wanted something like this when a co-worker was running a process that was outputting progress, and I didn't want to keep bugging them to see how far along it was. You could use it to check on something like that. The evil use case is just to watch what someone else is doing.
- bdg 11y agoOn BSD there's a fun little command called `watch` which lets me watch everything on any given TTY or even interact with it. Great when working on a system with a jr. team member who isn't familiar as you can both have hands-on a system.
- rickycook 11y agoalso interesting is reTTY http://pasky.or.cz//dev/retty/ http://pasky.or.cz//dev/retty/ it lets you "steal" the tty of a running process. benefits of this include starting tmux, then yanking an already running process into it
- achernya 11y agoIs there a comparison of reTTY with reptyr (https://github.com/nelhage/reptyr https://github.com/nelhage/reptyr)? reptyr claims to work with less while reTTY does not.