Smalltalk.st
changeset 21020 55d520adcce5
parent 21019 dc5142562d79
child 21021 1f8d5bc2a53e
--- a/Smalltalk.st	Wed Nov 23 17:37:42 2016 +0100
+++ b/Smalltalk.st	Wed Nov 23 17:52:13 2016 +0100
@@ -21,12 +21,12 @@
 		CachedAbbreviations VerboseStartup VerboseLoading Verbose
 		SilentLoading Initializing StandAlone HeadlessOperation IsPlugin
 		IsSharedLibraryComponent IsSTScript IsRepl DebuggingStandAlone
-		Debugging LogDoits LoadBinaries RealSystemPath ResourcePath
-		SourcePath BinaryPath FileInPath PackagePath BinaryDirName
-		ResourceDirName SourceDirName BitmapDirName PackageDirName
-		FileInDirName ChangeFileName ImageStartTime ImageRestartTime
-		DemoMode SaveEmergencyImage SpecialObjectArray CallbackSignal
-		ClassesFailedToInitialize HasNoConsole IgnoreHalt
+		Silent Debugging LogDoits LoadBinaries RealSystemPath
+		ResourcePath SourcePath BinaryPath FileInPath PackagePath
+		BinaryDirName ResourceDirName SourceDirName BitmapDirName
+		PackageDirName FileInDirName ChangeFileName ImageStartTime
+		ImageRestartTime DemoMode SaveEmergencyImage SpecialObjectArray
+		CallbackSignal ClassesFailedToInitialize HasNoConsole IgnoreHalt
 		PackageToPathMapping IgnoreAssertions LanguageModifier
 		LanguageCodeset'
 	poolDictionaries:''
@@ -762,7 +762,21 @@
         Logger notNil ifTrue:[
             Logger loggingThreshold: Logger severityALL.
         ].    
-        CommandLineArguments removeIndex:idx
+        CommandLineArguments removeIndex:idx.
+    ].
+
+    Silent := false.
+    (idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[
+        CommandLineArguments removeIndex:idx.
+        
+        Silent := SilentLoading := true.
+        Object infoPrinting:false.
+        ObjectMemory infoPrinting:false.
+        ObjectMemory debugPrinting:false.
+        Verbose := VerboseLoading := VerboseStartup := false.
+        Logger notNil ifTrue:[
+            Logger loggingThreshold: Logger severityNONE
+        ].    
     ].
 !
 
@@ -4375,7 +4389,14 @@
      Analyzes the command line and checks what to do 
      (i.e. script/repl/eval or full blown IDE).
      Also handles --load and various debug options.
-     Caveat: this has become too complicated and desperately needs a rewrite."
+     Caveat: 
+        this has become too complicated and desperately needs a rewrite.
+
+     Also:
+        Be very careful when changing things here; 
+        especially be careful to ensure that the scripting options are robust against any
+        missing packages; so the error handlers should not depend on any stream, logger etc. features.
+     "
 
     |idx graphicalMode arg didReadRCFile keepSplashWindow|
 
@@ -4485,7 +4506,9 @@
                             Debugging == true ifTrue:[
                                 MiniDebugger enterException:ex.
                             ] ifFalse:[
-                                ex description _errorPrintCR.
+                                Silent ifFalse:[
+                                    'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR.
+                                ].
                                 (VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[
                                     ex suspendedContext fullPrintAll.
                                 ].
@@ -4501,6 +4524,7 @@
                                     MiniDebugger enterException:ex.
                                     ex proceed.
                                 ].    
+                                Silent ifFalse:[ 'user interrupt.' errorPrintCR ].
                                 self exit:128+(OperatingSystem sigINT).
                             ] do:[
                                 arg = '-' ifTrue:[
@@ -4645,7 +4669,9 @@
                             Debugging == true ifTrue:[
                                 MiniDebugger enterException:ex.
                             ] ifFalse:[
-                                ex description _errorPrintCR.
+                                Silent ifFalse:[
+                                    'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR.
+                                ].    
                                 (VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[
                                     ex suspendedContext fullPrintAll.
                                 ].
@@ -4660,7 +4686,8 @@
                                     "/ thisContext fullPrintAll.
                                     MiniDebugger enterException:ex.
                                     ex proceed.
-                                ].    
+                                ].
+                                Silent ifFalse:[ 'user interrupt.' errorPrintCR ].
                                 self exit:128+(OperatingSystem sigINT).
                             ] do:[
                                 |filterCode filterStart filterEnd|