-USING: classes.singleton help.markup help.syntax kernel math ;
+USING: classes.singleton help.markup help.syntax init kernel math ;
IN: system
ABOUT: "system"
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 } }
! 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 ;
: 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.
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) ;