My console wrappers at the moment are both Smalltalk console applications written in Dolphin Smalltalk: ConsoleShell and ConsolePipe. ConsoleShell understands commands for several language configurations and writes to a named pipe opened and echoed by ConsolePipe1; ConsolePipe2 takes STDOUT and pipes it to a chosen NamedPipe to feedback to an IDE running the ConsoleShell.
The problem that I faced was to pipe out from rebol.exe as it is not enough just to use the -w option to prevent a window from opening.
The answer lay in a Rebol script not unlike what you might use to loop a Perl interpreter. In my test case, the following pipeline works under Windows XP:
ConsoleShell|
ConsolePipe1|
rebol.exe -w -c --do "forever [attempt [print do ask %~]]" 2>&1|
ConsolePipe2
The input is to my shell and the output appears in a destination window fed by a named pipe.
Unless you ran taskmgr you would not know that rebol.exe was running.
The two key bits are the -c flag and the print block. You also have to ignore the obvious and set the prompt ( in my case '->' ) with the '%' as indicated and you must wrap the script in dbl-quotes.
Now my ConsoleShell pipes into Rebol and Rebol outputs into my chosen Windows NamedPipe. This should work with any 2 wrappers - you might want to try with Tcl and expect. The Rebolution continues ...
1 comment:
Hi great tips, I will refer to your article in the future.
I have written also an article on redirecting output from a windows console program to rebol console see
http://reboltutorial.com/blog/redirect-shell-to-rebol-console/
Post a Comment