diff --git a/scriptlib/developer/piperepl/evalinput.tcl b/scriptlib/developer/piperepl/evalinput.tcl new file mode 100644 index 00000000..6c325918 --- /dev/null +++ b/scriptlib/developer/piperepl/evalinput.tcl @@ -0,0 +1,32 @@ + +set exebase [file rootname [file tail [info nameofexecutable]]] + +puts stdout "------------------------" +puts stdout "message from script" +puts stdout "exebase : $exebase" +puts stdout "::tcl_interactive : $::tcl_interactive" +puts stdout "::tclsh(istty) : $::tclsh(istty)" +puts stdout "------------------------" + + +#optionally read part or all of stdin, +#but we don't know how to put data back into stdin - so partial read should only be done if there is a protocol for the data to be read and processed. +#set inputdata [read stdin] + +if {"-noeval" ni $::argv} { + set ::tclsh(evalinput) 1 +} else { + if {"-eat2" in $::argv} { + set eat [read stdin 2] + puts stdout "stdin read: [string length $eat] bytes" + puts stdout $eat + puts stdout "info exist ::tclsh(inputbuffer): [info exists ::tclsh(inputbuffer)]" + } + #set ::tclsh(evalinput) 0 +} +#now that we have set the evalinput flag for PIPEREPL - when we exit this script - the piperepl will read from stdin and evaluate any remaining input as tcl code. +#This means that no matter what we do with ::tclsh(dorepl) - it could be overridden by the script on the input. that's ok. + +if {"-dorepl" in $::argv} { + set ::tclsh(dorepl) 1 +} \ No newline at end of file diff --git a/scriptlib/developer/piperepl/showinput.tcl b/scriptlib/developer/piperepl/showinput.tcl new file mode 100644 index 00000000..0bb2746e --- /dev/null +++ b/scriptlib/developer/piperepl/showinput.tcl @@ -0,0 +1,21 @@ + + +set exebase [file rootname [file tail [info nameofexecutable]]] + +puts stdout "------------------------" +puts stdout "message from script" +puts stdout "exebase : $exebase" +puts stdout "::tcl_interactive : $::tcl_interactive" +puts stdout "::tclsh(istty) : $::tclsh(istty)" +puts stdout "------------------------" + +if {!$::tcl_interactive} { + set data [read stdin] + puts stdout "stdin read: [string length $data] bytes" + puts stdout $data +} + +if {"-dorepl" in $::argv} { + set ::tclsh(dorepl) 1 + set ::tcl_interactive 1 +}