This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
angellus's profile picture

[Question] Intercepting terminal output stream

Started by angellus, 17 May 2013 - 05:06 PM
angellus #1
Posted 17 May 2013 - 07:06 PM
So, I want to write my own shell so I can various things, including suspending, resuming and running in the background for programs. I went through and read all the APIs and I could not find anything that sounds like it work. Does anyone know a way to intercept the output stream for a terminal? That way I can customize it to my likely.

If you want to know what I mean, I want to be able to get a return value from print() or term.write() or be able to know whenever they are ran or I want to be able to get the output of build in commands like ls something.
KaoS #2
Posted 18 May 2013 - 10:06 AM
take a look at my Layer API in my utilities post here

it records everything on the screen, you can recall the text at any part of the screen as well as the text color and background color. You can define separate text layers and even scroll the screen back upwards
angellus #3
Posted 18 May 2013 - 11:27 AM
That is basically what I was writing. Thanks. It should save me a lot of trouble.

EDIT: in fact, looking at your KaoShell, it already has a lot of the functionality I need. I will probably get ideas from it in making my own.
KaoS #4
Posted 18 May 2013 - 01:03 PM
That is basically what I was writing. Thanks. It should save me a lot of trouble.

EDIT: in fact, looking at your KaoShell, it already has a lot of the functionality I need. I will probably get ideas from it in making my own.

Great :)/> If you have any questions please PM me
NullSchritt #5
Posted 19 May 2013 - 08:16 PM
Hello KaoS, would it be possible to use your layering api to determine if a certain text has been output to the terminal? I am executing a command from terminal, and redirecting the output to the terminal, however, the amount of time that passes until the command finishes writing it's output varies, and so the only real way to make sure all status text is displayed, is to somehow be able to look for keywords within the text printed to the terminal, to look for either, an error code, a success code, a waiting code, etc.
KaoS #6
Posted 19 May 2013 - 09:19 PM
yeah use the term.getTextAt feature to recall text from the screen