zopencommunity / tclport

The Tcl scripting language
Apache License 2.0
0 stars 1 forks source link

puts [ exec <cmd> ] prints garbage #5

Open MikeFultonDev opened 1 year ago

MikeFultonDev commented 1 year ago

see https://github.com/ZOSOpenTools/tclport/blob/getbuilding/tests/exectest.tcl

MikeFultonDev commented 1 year ago

unix/tclUnixPipe.c: tclpCreatePipe sets up read and write pipes using fcntl.

MikeFultonDev commented 1 year ago

@IgorTodorovskiIBM does zoslib provide it's own fcntl?

MikeFultonDev commented 1 year ago

This looks sketchy:


/*
 * The following macros convert between TclFile's and fd's. The conversion
 * simple involves shifting fd's up by one to ensure that no valid fd is ever
 * the same as NULL.
 */

#define MakeFile(fd)  ((TclFile) INT2PTR(((int) (fd)) + 1))
#define GetFd(file) (PTR2INT(file) - 1)
IgorTodorovskiIBM commented 1 year ago

Hmm, interesting. I wonder why they don't just use pipe. We don't override fcntl right now.