Hi,
Windows 7
Tcl 8.6.11
java 1.8.0_291
I create a standalone pipe with chan pipe command to redirect stderr from a subprocess java (executed in background with exec command). See following code :
lassign [chan pipe] readSide writeSide
exec ... 2>@ $writeSide &
close $writeSide
chan event $readSide readable {
# read stderr
}
I have some questions :
What is the best way to read the stderr ? read or gets command ?
If I use the read command, do I configure readSide in non-blocking mode to read without wait an end-of-file ?
Thank
Jean-Baptiste
On Friday, October 8, 2021 at 12:05:39 PM UTC+2, Jean-Baptiste Gardette wrote:
Hi,
Windows 7
Tcl 8.6.11
java 1.8.0_291
I create a standalone pipe with chan pipe command to redirect stderr from a subprocess java (executed in background with exec command). See following code :
lassign [chan pipe] readSide writeSide
exec ... 2>@ $writeSide &
close $writeSide
chan event $readSide readable {
# read stderr
}
I have some questions :
What is the best way to read the stderr ? read or gets command ?
If I use the read command, do I configure readSide in non-blocking mode to read without wait an end-of-file ?
ThankI think you should use the fileevent command (see for instance https://wiki.tcl-lang.org/page/fileevent). The tutorial has a few straightforward examples at https://wiki.tcl-lang.org/page/Tcl+Tutorial+Lesson+26a.
Jean-Baptiste
Regards,
Arjen
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 285 |
Nodes: | 16 (2 / 14) |
Uptime: | 21:50:45 |
Calls: | 6,448 |
Files: | 12,050 |
Messages: | 5,254,047 |