Changeset 118302 for trunk/base


Ignore:
Timestamp:
Mar 29, 2014, 4:41:17 PM (10 years ago)
Author:
cal@…
Message:

base: Print a message when rolling back on user request, prevent rollback interruption

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/registry2.0/portimage.tcl

    r116450 r118302  
    4040package require macports 1.0
    4141package require Pextlib 1.0
     42
     43package require Tclx
    4244
    4345set UI_PREFIX "--> "
     
    540542                    }
    541543                }
     544            } catch {{POSIX SIG SIGINT} eCode eMessage} {
     545                # Pressing ^C will (often?) print "^C" to the terminal; send
     546                # a linebreak so our message appears after that.
     547                ui_msg ""
     548                ui_msg "Control-C pressed, rolling back, please wait."
     549                # can't do it here since we're already inside a transaction
     550                set deactivate_this yes
     551                throw
     552            } catch {{POSIX SIG SIGTERM} eCode eMessage} {
     553                ui_msg "SIGTERM received, rolling back, please wait."
     554                # can't do it here since we're already inside a transaction
     555                set deactivate_this yes
     556                throw
    542557            } catch {*} {
    543558                ui_debug "Activation failed, rolling back."
     
    548563        }
    549564    } catch {*} {
     565        # This code must run to completion, or the installation might be left
     566        # in an inconsistent state
     567        signal block {TERM INT}
     568
    550569        # roll back activation of this port
    551570        if {[info exists deactivate_this]} {
     
    564583            }
    565584        }
     585
     586        # We've completed all critical operations, re-enable the TERM and INT
     587        # signals.
     588        signal unblock {TERM INT}
     589
    566590        # remove temp image dir
    567591        ::file delete -force $extracted_dir
Note: See TracChangeset for help on using the changeset viewer.