Attachment "repro.c" to
ticket [91c9bc1c45]
added by
serhiy.storchaka
2026-11-12 20:28:42.
/* Tcl ticket 91c9bc1c45. Windows only. Run with stdout redirected to a
* file: repro.exe > out.txt */
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <tcl.h>
int
main(int argc, char **argv)
{
Tcl_Interp *interp;
Tcl_FindExecutable(argv[0]);
interp = Tcl_CreateInterp();
Tcl_Eval(interp, "fconfigure stdout"); /* create the stdout channel */
_dup2(_open("captured.txt", _O_WRONLY|_O_CREAT|_O_TRUNC, 0666), 1);
if (Tcl_Eval(interp, "close [open repro.c]") != TCL_OK) {
fprintf(stderr, "error: \"%s\"\n", Tcl_GetStringResult(interp));
return 1;
}
fprintf(stderr, "ok\n");
return 0;
}