The Inbox: System-ct.1530.mcz

[email protected] Sun, 2 Aug 2026 19:58:03 0000
Newsgroups gmane.comp.lang.smalltalk.squeak.general
Message-ID <[email protected]>
Christoph Thiede uploaded a new version of System to project The Inbox:
http://source.squeak.org/inbox/System-ct.1530.mcz

==================== Summary ====================

Name: System-ct.1530
Author: ct
Time: 2 August 2026, 9:58:02.421914 pm
UUID: c12b6a09-5a7b-4436-83e9-e9fc7624ceb0
Ancestors: System-ct.1528

Proposal: Displays verbose print strings including a stack for DoItFirst errors. This would make troubleshooting for the CLI interface significantly easier.

Not exhaustively tested; nothing for 6.1.

=============== Diff against System-ct.1528 ===============

Item was changed:
  ----- Method: DoItFirst>>doIt: (in category 'actions') -----
  doIt: arguments
  	"Evaluate arguments and print the result on stdout, or error message on stderr.
  	Exit the image after any error."
  	arguments do: [ :arg |
  		[ self printOut: (Compiler evaluate: arg) printString ]
  			on: Error
+ 			do: [ :ex | self printError: ex ]].!
- 			do: [ :ex | self printError: ex asString ]].!

Item was changed:
  ----- Method: DoItFirst>>evaluateFileContents: (in category 'actions') -----
  evaluateFileContents: fileName
  	"Evaluate the contents of a file and print the result on stdout, or error
  	message on stderr. Exit immediately without saving the image."
  
  	| fs arg |
  	[fs := FileStream oldFileNamed: fileName.
  	[arg := fs contentsOfEntireFile.
  	^ self evaluateOption: arg]
  			ensure: [fs close]]
  		on: Exception
+ 		do: [:ex | (self printError: ex)
- 		do: [:ex | (self printError: ex asString)
  				ifTrue: [Smalltalk quitPrimitive]].!

Item was changed:
  ----- Method: DoItFirst>>evaluateOption: (in category 'actions') -----
  evaluateOption: arg
  	"Evaluate option and print the result on stdout, or error message on stderr.
  	Exit immediately without saving the image."
  	| safeToQuit |
  	[ safeToQuit := self printOut: (Compiler evaluate: arg) printString ]
  		on: Error
+ 		do: [ :ex | safeToQuit := self printError: ex ].
- 		do: [ :ex | safeToQuit := self printError: ex asString ].
  	safeToQuit ifTrue: [ Smalltalk quitPrimitive ].!

Item was changed:
  ----- Method: DoItFirst>>fileIn: (in category 'actions') -----
  fileIn: fileNames
  	"File in each named file. On error, print a message to stderr and exit the image."
  	fileNames do: [ :arg |
  		[ | fs |
  		fs := FileStream oldFileNamed: arg.
  		self printOut: 'file in ', fs name.
  		fs fileIn ]
  			on: Error
+ 			do: [ :ex | (self printError: ex)
- 			do: [ :ex | (self printError: ex asString)
  					ifTrue: [ Smalltalk quitPrimitive ]]].!

Item was changed:
  ----- Method: DoItFirst>>printError: (in category 'private') -----
+ printError: anErrorOrString
- printError: aString
  	"Print to stdout if available, otherwise to the transcript. Answer true if
  	the stdio stream was used, false if output was redirected to transcript."
+ 	[ anErrorOrString isString
+ 		ifTrue: [ FileStream stderr nextPutAll: anErrorOrString ]
+ 		ifFalse: [ anErrorOrString printVerboseOn: FileStream stderr ].
+ 	FileStream stderr lf; flush ]
- 	[ FileStream stderr nextPutAll: aString; lf; flush ]
  		on: Error
  		do: [ TranscriptStream forceUpdate: false. "Graphics not yet fully initialized."
+ 			Transcript cr; show: self class name , ' error: ', anErrorOrString; flush.
- 			Transcript cr; show: self class name , ' error: ', aString; flush.
  			^false ].
  	^true.
  !

Squeak-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]