On 4/30/2024 3:11 PM, Donald Arseneau wrote:
Donald Arseneau <[email protected]> writes:
I wonder if I can start that program in a way that defeats buffering...
I should add that I tried
fconfigure $pfh -blocking 0 -buffering none -translation binary
and lots of
flush $pfh
already.
Since you have a "black-box" executable, what about redirecting both it's input/output and then use named pipes for both, to see what's going on.
I got chatGPT to write some code in C, python, and Tcl for creating and then reading/writing to named pipes.
From a command line you can then do: foobar.exe < \\.\pipe\MyNamedPipe
to see if foobar.exe will cooperate on reading from a pipe. You can also then send it stuff, and multiple readers will each see all the data (like tee), or so chatGPT tells me.
FWIW, chatGPT seemed pretty knowledgeable about named pipes and wrote some decent Tcl code :)
Here's what it gave me as a test program to write to the pipe:
proc write_to_named_pipe {pipe_tail data} {
set pipeName "\\\\.\\pipe\\$pipe_tail"
set pipe [open $pipeName w]
puts $pipe $data
close $pipe
}
# Check if two command-line arguments are provided
if {[llength $argv] == 2} {
# Get the command-line arguments
set data [lindex $argv 0]
set pipeTail [lindex $argv 1]
# Write the data to the named pipe
write_to_named_pipe $pipeTail $data
} else {
puts "Usage: tclsh script_name.tcl data pipe_tail"
}
-e
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)