]> gitweb.factorcode.org Git - factor.git/commitdiff
system: dont let any errors interfere with the shutdown process and just
authorBjörn Lindqvist <bjourne@gmail.com>
Fri, 19 Sep 2014 14:31:14 +0000 (16:31 +0200)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 11 Nov 2014 07:30:03 +0000 (23:30 -0800)
ignore them

Conflicts:
core/system/system.factor

core/system/system-docs.factor
core/system/system.factor

index 3e8c0b4fcc976aa619af597c43f89255f87d6ec8..134d9d9059bcb033e666b0a3ee0345e90c1be5b5 100644 (file)
@@ -1,4 +1,4 @@
-USING: classes.singleton help.markup help.syntax kernel math ;
+USING: classes.singleton help.markup help.syntax init kernel math ;
 IN: system
 
 ABOUT: "system"
@@ -65,7 +65,7 @@ HELP: embedded?
 
 HELP: exit
 { $values { "n" "an integer exit code" } }
-{ $description "Exits the Factor process." } ;
+{ $description "Runs all " { $link shutdown-hooks } " and then exits the Factor process. If an error occurs when the shutdown hooks runs, or when the process is about to terminate, the error is ignored and the process exits with status 255." } ;
 
 HELP: nano-count
 { $values { "ns" integer } }
index 93cb9a4513d5df5008d845cda6b764cce78564a7..c077da71916078b1fa62cbc4fb4617bc9a7ff07a 100644 (file)
@@ -1,6 +1,7 @@
 ! Copyright (C) 2007, 2010 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs init kernel kernel.private make namespaces sequences strings  ;
+USING: assocs continuations init io kernel kernel.private make
+namespaces sequences ;
 IN: system
 
 SINGLETONS: x86.32 x86.64 arm ppc.32 ppc.64 ;
@@ -61,9 +62,9 @@ PRIVATE>
 
 : vm ( -- path ) \ vm get-global ;
 
-: embedded? ( -- ? ) OBJ-EMBEDDED special-object ;
+: install-prefix ( -- path ) \ install-prefix get-global ;
 
-: exit ( n -- * ) do-shutdown-hooks (exit) ;
+: embedded? ( -- ? ) OBJ-EMBEDDED special-object ;
 
 : version-info ( -- str )
     ! formatting vocab not available in this context.
@@ -72,3 +73,8 @@ PRIVATE>
         vm-compile-time % ") [" %
         vm-compiler % " " % cpu cpu>string % "] on " % os os>string %
     ] "" make ;
+
+: exit ( n -- * )
+    [ do-shutdown-hooks (exit) ] ignore-errors
+    [ "Unexpected error during shutdown!" print ] ignore-errors
+    255 (exit) ;