REBOL Developer Network

Enbase 2.7.4 with stdio redirection and CGI

Carl Sassenrath, CTO
REBOL Technologies
30-Nov-2006 20:19 GMT

Article #0012
Main page || Index || Prior Article [0011] || Next Article [0013] || 33 Comments || Send feedback

For SDK developers: There is a test build of Enbase 2.7.4 for win32 that allows stdio port redirection and CGI handling. Goto http://www.rebol.net/builds/031/

To make this possible, we've re-enabled these runtime flags for encap created programs:

-w  for no-window mode - use for redirection
-c  for cgi mode - CGI envr flags, redirection

These even work for the encap app itself as well as your output builds.

Not in Encap Block

The above flag is used with the execuable encapped file (your program). It is not something that you set with the encap options block (in the script header). This allows a single program to function both with a GUI and also in the shell (or other environments, such as web servers).

However, if your program uses -w or -c for other purposes, you will need to pick another character.

Examples

Redirect to a file:

C:>more test.r
REBOL []
print "it works"
C:>enbase test.r
C:>test -w > out.txt
C:>more out.txt
it works

Redirect from a file:

C:>more test.r
REBOL []
print ask "What?"
C:>enbase test.r
C:>echo "testing123" >input.txt
C:>test -w <input.txt >out.txt
C:>more out.txt
What?"testing123"

Pipe output:

C:>more test.r
REBOL []
print "hello"
C:>enbase test.r
C:>test -w | more
hello

Pipe input:

C:>more test.r
REBOL []
print copy system/ports/input
C:>enbase test.r
C:>dir | test -w >out.txt
C:>more out.txt
Volume in drive C has no label.
Volume Serial Number is ECC1-792C
Directory of C:\build\to-win32
\baseencap  11/30/2006  02:46 PM    <DIR>         
. 11/30/2006  02:46 PM    <DIR>
.. 11/22/2006  06:07 PM ...

(Line breaks are a bit odd on that last output.)

Want it?

If this change tests out, we can look at backporting to the 2.6 SDK products as requested by developers.

Thanks to Maxim Olivier-Adlhoch for helping to push this change.

33 Comments

Updated 10-Sep-2009   -   Copyright 2006 Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code