2 Jul 23:51
Re: Future [exec] overhaul
From: Larry McVoy <lm@...>
Subject: Re: Future [exec] overhaul
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-02 21:51:39 GMT
Subject: Re: Future [exec] overhaul
Newsgroups: gmane.comp.lang.tcl.core
Date: 2008-07-02 21:51:39 GMT
> (2) Get rid of complicated legacy rules regarding the scope and > semantics of redirection. These include the csh-style >&, the > global-scope 2>, the special case 2>@1, and the recent -ignorestderr. > All this to be forgotten in favour of the clean, symmetric syntax of > the Bourne shell: > > [exec foo 2>@1] --> [exec2 foo 2>&1] > [exec foo |& bar] --> [exec2 foo 2>&1 | bar] > (impossible) --> [exec2 foo 2>& $ch1 | bar 2>& $ch2] > [exec foo 2>@ stderr] --> [exec2 foo] > [exec -ignorestderr foo] --> [exec2 foo] > > (notice that I chose >& instead of >@ for two reasons: (1) to mark the > Bourne Shell heritage and (2) to avoid too easy copy/paste confusions > with old [exec]) > > (3) Generalize on unix to fds above 2 as in Bourne shell and as shown > in the TIP under section "Directions for future work": > > (impossible) --> [exec2 foo 3>& $ch1 | bar 4<& $ch2] > > (4) Give a means to get the exit status at the end of an [exec2 ... > &]. One possibility is a simple, synchronous [waitpid], assuming that > by listening to one of its output descriptors one is able to have a > reasonable notification of when a [waitpid] would not block for too > long (which would be defeated by a [close stdout] in the child). A > more advanced option is to create a pseudo-channel who would fire a > fileevent readable on SIGCHLD. A third one would be a > Tcl_AsyncMark-based script-level signal handler (for SIGCHLD among > others). Great start! Is there any reason to keep the exec name? You have no idea how many times I've heard "tcl, the only language where exec doesn't". What would be wrong with calling it system, like system(3). We've written a system clone that doesn't use sh but supports much of the shell syntax you describe above. -- -- --- Larry McVoy lm at bitmover.com http://www.bitkeeper.com ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
RSS Feed