Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 29f777aad34f025078cdf53022ae3531ee713d96
Ticket: 61f50377506aeb6ebb85a242b3e5ac592bf3aef5
wish doesn't print to stdout on windows
User & Date: anonymous on 2015-10-08 04:59:03
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed 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]
    
  5. foundin changed to: "8.6"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "1c4b6cdb98c9dfc4d1e74018f3f4efa00ad217e2"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "25. Channel System"
  15. title changed to: "wish doesn't print to stdout on windows"
  16. type changed to: "Bug"