

          dup filehandle [stdhandle]
               Duplicate an open file.  A file handle is created that
               addresses the same file as filehandle.

               A special case is allowed for dup-ing files to stdin,
               stdout or stderr.  If stdhandle is specified, then it
               must be one of the standard handles to dup filehandle
               to.

                   proc ChildProcess {cmd inPipe outPipe} {
                       if {[set childPid [fork]] == 0} {
                           close stdin
                           dup $inPipe stdin
                           close $inPipe

                           close stdout
                           dup $outPipe stdout
                           close $outPipe

                           execvp $cmd
                           # will never make it here...
                       }
                       return $childPid
                   }
