Changeset 146708 for trunk/base


Ignore:
Timestamp:
Mar 15, 2016, 4:40:00 PM (4 years ago)
Author:
cal@…
Message:

base: Print NL after errors in interactivity

When one of the prompts in the interactivity handling code aborts (due to an
error or a signal), print a newline to ensure the any output that is produced
afterwards (such as error messages) will be printed in the next line.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r146705 r146708  
    53455345        signal error {TERM INT}
    53465346        while {$timeout >= 0} {
    5347             if {[catch {set inp [read stdin]} err]} {
    5348                 return -code error "Ctrl-C"
     5347            try {
     5348                set inp [read stdin]
     5349            } catch {*} {
     5350                # An error occurred, print a newline so the error message
     5351                # doesn't occur on the prompt line and re-throw
     5352                puts ""
     5353                throw
    53495354            }
    53505355            if {$inp eq "\n"} {
     
    54455450        while 1 {
    54465451            signal error {TERM INT}
    5447             if {[catch {set input [gets stdin]} err]} {
    5448                 return -code error "Ctrl-C"
     5452            try {
     5453                set input [gets stdin]
     5454            } catch {*} {
     5455                # An error occurred, print a newline so the error message
     5456                # doesn't occur on the prompt line and re-throw
     5457                puts ""
     5458                throw
    54495459            }
    54505460            signal -restart error {TERM INT}
     
    54795489            flush stdout
    54805490            signal error {TERM INT}
    5481             if {[catch {set input [gets stdin]} err]} {
    5482                 return -code error "Ctrl-C"
     5491            try {
     5492                set input [gets stdin]
     5493            } catch {*} {
     5494                # An error occurred, print a newline so the error message
     5495                # doesn't occur on the prompt line and re-throw
     5496                puts ""
     5497                throw
    54835498            }
    54845499            signal -restart error {TERM INT}
     
    55105525            flush stdout
    55115526            signal error {TERM INT}
    5512             if {[catch {set input [gets stdin]} err]} {
    5513                 return -code error "Ctrl-C"
     5527            try {
     5528                set input [gets stdin]
     5529            } catch {*} {
     5530                # An error occurred, print a newline so the error message
     5531                # doesn't occur on the prompt line and re-throw
     5532                puts ""
     5533                throw
    55145534            }
    55155535            signal -restart error {TERM INT}
Note: See TracChangeset for help on using the changeset viewer.