From: Gustaf N. <ne...@wu...> - 2017-02-20 19:47:55
|
Am 20.02.17 um 16:01 schrieb Brian Fenton: > > HI Gustaf > > I’d guess this is not a Windows thing, as I can reproduce the problem > in standard TCL on both Windows and Linux. But I haven’t looked at > Naviserver on Linux to confirm it there. > > This worked fine for years in AOLserver on both Windows and Linux. It > seems to be that Naviserver’s version of “open” is closer to the > standard TCL version. > naviserver is not "closer" to Tcl, it uses the Tcl unmodified (including open). I see in the AOLserver sources no place, where it overwrites/modifies the "open" command. > > When should I write the “exit\n” to the pipe? I’ve tried a few > variations on the following with no success: > > set fp [open "|[file join $::env(ORACLE_HOME) bin sqlplus] $user_pass > @$file" "r+"] > > puts $fp "exit\n" > > while { [gets $fp line] >= 0 } { > > append output $line > > } > > close $fp > The following should work. this is a little script (that works under Unix) that emulates sqlplus - as i understand it. Hope this helps -g ================================================================================ #!/usr/bin/env tclsh puts "GOT args <$argv>" # # Read a line from stdin to emulate, what sqlplus is doing # set line [gets stdin] puts "GOT line <$line>" if {0} { # # Place this file into /tmp/sqlplus.tcl, make it executable, call a # tclsh, and issue in this shell the following cmds: # set user_pass pw set file test.sql set fp [open "| /tmp/sqlplus.tcl $user_pass @$file" "r+"] fconfigure $fp -buffering line puts $fp "exit" while { [gets $fp line] >= 0 } { append output $line \n } close $fp puts output:\n$output } ================================================================================ |