Artifacts Associated With Ticket 61f50377506aeb6e
Ticket change [29f777aad3] (rid 143465) by anonymous on 2015-10-08 04:59:03:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Hi, I tried to print to stdout using wish on windows. I tried this: puts hello But it doesn't print nothing to stdout. I developed a code to get the clipboard data from a Tcl program executed using tclsh. But this code doesn't work on windows and I think that the reason is that nothing is sent to stdout. This is the code: namespace eval clipboard { namespace export append clear get close namespace ensemble create variable mypipeline variable clipboard_data variable clipboard_length proc Initialization {path_to_wish} { variable mypipeline [open |$path_to_wish r+] fconfigure $mypipeline -buffering line puts $mypipeline {fconfigure stdout -buffering line} puts $mypipeline {wm withdraw .} } proc append {txt} { variable mypipeline puts $mypipeline "clipboard append [list $txt]" } proc clear {} { variable mypipeline puts $mypipeline {clipboard clear} } proc get {} { variable mypipeline variable clipboard_data variable clipboard_length puts $mypipeline { if {[catch {set clipboard_data [clipboard get]}]} { return 0 } else { puts [string length $clipboard_data] puts -nonewline $clipboard_data flush stdout } } fileevent $mypipeline readable ::clipboard::GetClipboardLength vwait getting_length if {$clipboard_length == 0} { set clipboard_data "" } else { fileevent $mypipeline readable ::clipboard::GetClipboardData vwait getting_data fileevent $mypipeline readable "" } return $clipboard_data } proc GetClipboardData {} { variable mypipeline variable clipboard_data variable clipboard_length upvar getting_data getting_data set clipboard_data [read $mypipeline $clipboard_length] set getting_data 1 } proc GetClipboardLength {} { variable mypipeline variable clipboard_length upvar getting_length getting_length set clipboard_length [gets $mypipeline] set getting_length 1 } proc close {} { variable mypipeline close $mypipeline } } ::clipboard::Initialization /usr/local/bin/wish8.6 ::clipboard append hola puts [clipboard get] - foundin initialized to: "8.6"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- private_contact initialized to: "1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "25. Channel System"
- title initialized to: "wish doesn't print to stdout on windows"
- type initialized to: "Bug"
Ticket change [1d8ffba935] (rid 143466) by apnadkarni on 2015-10-08 05:56:20:
- icomment:
I suspect this is because by design wish on Windows has its own "console" window which is where all output to stdout is sent. The puts with clipboard data will be printed to this window (which you can see with "console show") and not to your pipe.
- login: "apnadkarni"
- mimetype: "text/plain"
- icomment:
Ticket change [4731a01196] (rid 143467) by jan.nijtmans on 2015-10-08 08:43:31:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2457303.86356069"
- closer changed to: "jan.nijtmans"
- icomment:
On Windows, GUI applications don't have stdin/stdout/stderr. However, it is possible to run Tk in a console application. So: just run tclsh86.exe in stead of wish86.exe. If your scripts starts with "package require Tk", any GUI is usable, and there is a console as well. Any applications which expects stdout to work should do this.
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"