<div dir="ltr">+1, please include in the update.mcm!<br>I also like the Pharo alternative to Fuel out the error context...<br>Lighter than full image save. Oh but we don't have Fuel yet :(<br>Who wants to make it with a segment?<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/31 <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Frank Shearar uploaded a new version of CommandLine to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/CommandLine-fbs.1.mcz" target="_blank">http://source.squeak.org/trunk/CommandLine-fbs.1.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: CommandLine-fbs.1<br>
Author: fbs<br>
Time: 31 October 2013, 10:32:52.821 pm<br>
UUID: dc871e85-bd16-d742-acbf-4d2b838113d1<br>
Ancestors:<br>
<br>
CommandLineToolSet does little more than dump errors to stderr.<br>
<br>
DummyUIManager comes from Pharo via Pavel Krivanek's minimising script.<br>
<br>
==================== Snapshot ====================<br>
<br>
SystemOrganization addCategory: #'CommandLine-Tools'!<br>
SystemOrganization addCategory: #'CommandLine-UIManager'!<br>
<br>
UIManager subclass: #DummyUIManager<br>
instanceVariableNames: ''<br>
classVariableNames: ''<br>
poolDictionaries: ''<br>
category: 'CommandLine-UIManager'!<br>
<br>
!DummyUIManager commentStamp: 'fbs 10/31/2013 07:36' prior: 0!<br>
I'm an alternative UIManager used to run an the image without GUI. I redefine methods which require user input as these requests are irrelevant in a headless environment. !<br>
<br>
----- Method: DummyUIManager>>checkForNewDisplaySize (in category 'display') -----<br>
checkForNewDisplaySize<br>
Display extent = DisplayScreen actualScreenSize ifTrue: [^ self].<br>
DisplayScreen startUp.<br>
!<br>
<br>
----- Method: DummyUIManager>>chooseDirectory:from: (in category 'ui requests') -----<br>
chooseDirectory: label from: dir<br>
^ nil!<br>
<br>
----- Method: DummyUIManager>>chooseFrom:lines:title: (in category 'ui requests') -----<br>
chooseFrom: aList lines: linesArray title: aString<br>
^ aList first!<br>
<br>
----- Method: DummyUIManager>>chooseFrom:values:lines:title: (in category 'ui requests') -----<br>
chooseFrom: labelList values: valueList lines: linesArray title: aString<br>
^ valueList first!<br>
<br>
----- Method: DummyUIManager>>confirm: (in category 'ui requests') -----<br>
confirm: queryString<br>
(ProvideAnswerNotification signal: queryString)<br>
ifNotNil: [:answer|^answer].<br>
<br>
self error: 'No user response possible'!<br>
<br>
----- Method: DummyUIManager>>confirm:orCancel: (in category 'ui requests') -----<br>
confirm: aString orCancel: cancelBlock<br>
(ProvideAnswerNotification signal: aString) ifNotNil: [:answer |<br>
^answer == #cancel ifTrue: [cancelBlock value] ifFalse: [answer]].<br>
<br>
self error: 'No user response possible'!<br>
<br>
----- Method: DummyUIManager>>displayProgress:at:from:to:during: (in category 'ui requests') -----<br>
displayProgress: titleString at: aPoint from: minVal to: maxVal during: workBlock<br>
^ workBlock value: Association new!<br>
<br>
----- Method: DummyUIManager>>edit:label:accept: (in category 'ui requests') -----<br>
edit: aText label: labelString accept: anAction<br>
^ nil!<br>
<br>
----- Method: DummyUIManager>>fontFromUser: (in category 'ui requests') -----<br>
fontFromUser: priorFont<br>
self error: 'No user response possible'!<br>
<br>
----- Method: DummyUIManager>>inform: (in category 'ui requests') -----<br>
inform: aString<br>
"Nothing to be done here"!<br>
<br>
----- Method: DummyUIManager>>informUserDuring: (in category 'ui requests') -----<br>
informUserDuring: aBlock<br>
aBlock value: nil!<br>
<br>
----- Method: DummyUIManager>>newDisplayDepthNoRestore: (in category 'display') -----<br>
newDisplayDepthNoRestore: pixelSize<br>
"Change depths. Check if there is enough space!! , di"<br>
| area need |<br>
pixelSize = Display depth ifTrue: [^ self "no change"].<br>
pixelSize abs < Display depth ifFalse:<br>
["Make sure there is enough space"<br>
area := Display boundingBox area. "pixels"<br>
<br>
need := (area * (pixelSize abs - Display depth) // 8) "new bytes needed"<br>
+ Smalltalk lowSpaceThreshold.<br>
(Smalltalk garbageCollectMost <= need<br>
and: [Smalltalk garbageCollect <= need])<br>
ifTrue: [self error: 'Insufficient free space']].<br>
Display setExtent: Display extent depth: pixelSize.<br>
<br>
DisplayScreen startUp!<br>
<br>
----- Method: DummyUIManager>>request:initialAnswer: (in category 'ui requests') -----<br>
request: queryString initialAnswer: defaultAnswer<br>
(ProvideAnswerNotification signal: queryString)<br>
ifNotNil: [:answer |<br>
^ answer == #default ifTrue: [defaultAnswer] ifFalse: [answer]].<br>
<br>
self error: 'No user response possible'!<br>
<br>
----- Method: DummyUIManager>>requestPassword: (in category 'ui requests') -----<br>
requestPassword: queryString<br>
^ self request: queryString initialAnswer: ''!<br>
<br>
----- Method: DummyUIManager>>restoreDisplay (in category 'display') -----<br>
restoreDisplay!<br>
<br>
----- Method: DummyUIManager>>restoreDisplayAfter: (in category 'display') -----<br>
restoreDisplayAfter: aBlock<br>
aBlock value.<br>
Sensor waitButton.!<br>
<br>
StandardToolSet subclass: #CommandLineToolSet<br>
instanceVariableNames: ''<br>
classVariableNames: 'SaveSnapshotOnError'<br>
poolDictionaries: ''<br>
category: 'CommandLine-Tools'!<br>
<br>
----- Method: CommandLineToolSet class>>debugError: (in category 'debugging') -----<br>
debugError: anError<br>
"Print out a sensible stack trace and bail"<br>
| problemPlace s |<br>
self saveSnapshotOnError<br>
ifTrue: [Smalltalk saveAs: 'Debug-' , (Smalltalk imageName subStrings: '/') last].<br>
problemPlace := anError signalerContext.<br>
s := FileStream stderr.<br>
(anError isKindOf: MessageNotUnderstood) ifTrue: [<br>
s<br>
nextPutAll: anError messageText; cr;<br>
nextPutAll: problemPlace sender methodNode printString; cr].<br>
(problemPlace stackOfSize: 20) do: [:ctx | s cr. ctx printOn: s].<br>
s flush.<br>
<br>
SmalltalkImage current snapshot: false andQuit: true!<br>
<br>
----- Method: CommandLineToolSet class>>debugSyntaxError: (in category 'debugging') -----<br>
debugSyntaxError: anError<br>
| s |<br>
s := FileStream stderr.<br>
s nextPutAll: '----- Syntax error -----'; cr.<br>
s nextPutAll: anError errorCode; cr.<br>
s nextPutAll: '----- Syntax error -----'; cr.<br>
<br>
self debugError: anError!<br>
<br>
----- Method: CommandLineToolSet class>>saveSnapshotOnError (in category 'preferences') -----<br>
saveSnapshotOnError<br>
<preference: 'Save snapshot of image on failure'<br>
category: 'debug'<br>
description: 'If true, saves a snapshot of the failing image to the current directory.'<br>
type: #Boolean><br>
^ SaveSnapshotOnError ifNil: [SaveSnapshotOnError := false].!<br>
<br>
----- Method: CommandLineToolSet class>>saveSnapshotOnError: (in category 'preferences') -----<br>
saveSnapshotOnError: aBoolean<br>
SaveSnapshotOnError := aBoolean.!<br>
<br>
----- Method: CommandLineToolSet class>>unload (in category 'class initialization') -----<br>
unload<br>
ToolSet unregister: self.!<br>
<br>
<br>
</blockquote></div><br></div>