Skip to content

Commit

Permalink
base: setup signal handling in mportinit
Browse files Browse the repository at this point in the history
Given the code already in registry2.0/portimage.tcl this will finally prevent
inconsistent state when an activation operation is interrupted. The code there
will correctly catch the error and roll back the changes made to the
filesystem.

There might be further places where MacPorts could be smarter now that is has
signal handling code, but I think this change is already a huge improvement.

git-svn-id: https://svn.macports.org/repository/macports/trunk/base@118298 d073be05-634f-4543-b044-5fe20cf6d1d6
  • Loading branch information
neverpanic committed Mar 29, 2014
1 parent 1c1b6e0 commit 384c67c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/macports1.0/macports.tcl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
package provide macports 1.0 package provide macports 1.0
package require macports_dlist 1.0 package require macports_dlist 1.0
package require macports_util 1.0 package require macports_util 1.0
package require Tclx


namespace eval macports { namespace eval macports {
namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases
Expand Down Expand Up @@ -588,6 +589,11 @@ proc mportinit {{up_ui_options {}} {up_options {}} {up_variations {}}} {
# Set the system encoding to utf-8 # Set the system encoding to utf-8
encoding system utf-8 encoding system utf-8


# Set up signal handling for SIGTERM and SIGINT
# Specifying error here will case the program to abort where it is with
# a Tcl error, which can be caught, if necessary.
signal -restart error {TERM INT}

# set up platform info variables # set up platform info variables
set os_arch $tcl_platform(machine) set os_arch $tcl_platform(machine)
if {$os_arch eq {Power Macintosh}} {set os_arch "powerpc"} if {$os_arch eq {Power Macintosh}} {set os_arch "powerpc"}
Expand Down

0 comments on commit 384c67c

Please sign in to comment.