Skip to content
Permalink
Browse files

base: setup signal handling in mportinit

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 384c67cfe2c2ffe68ae90f4c1e428d5d2d899897
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/macports1.0/macports.tcl
@@ -36,6 +36,7 @@
package provide macports 1.0
package require macports_dlist 1.0
package require macports_util 1.0
package require Tclx

namespace eval macports {
namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases
@@ -588,6 +589,11 @@ proc mportinit {{up_ui_options {}} {up_options {}} {up_variations {}}} {
# Set the system encoding to 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 os_arch $tcl_platform(machine)
if {$os_arch eq {Power Macintosh}} {set os_arch "powerpc"}

0 comments on commit 384c67c

Please sign in to comment.
You can’t perform that action at this time.