The Inbox: System-ul.528.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: System-ul.528.mcz

commits-2
A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-ul.528.mcz

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

Name: System-ul.528
Author: ul
Time: 12 May 2013, 10:33:50.489 pm
UUID: d59743da-b5a5-4413-81f4-eb6dd7f7704d
Ancestors: System-fbs.527

Added support for defining the exit code when quitting.

=============== Diff against System-fbs.527 ===============

Item was added:
+ ----- Method: SmalltalkImage>>quitPrimitive: (in category 'snapshot and quit') -----
+ quitPrimitive: exitCode
+ "Primitive. Exit with exitCode to another operating system on the host machine, if one exists. All state changes in the object space since the last snapshot are lost. Ignore exitCode if it's not supported by the VM."
+
+ <primitive: 113>
+ self quitPrimitive!

Item was changed:
  ----- Method: SmalltalkImage>>snapshot:andQuit:embedded: (in category 'snapshot and quit') -----
  snapshot: save andQuit: quit embedded: embeddedFlag
- "Mark the changes file and close all files as part of #processShutdownList.
- If save is true, save the current state of this Smalltalk in the image file.
- If quit is true, then exit to the outer OS shell.
- The latter part of this method runs when resuming a previously saved image. This resume logic checks for a document file to process when starting up."
- | resuming msg |
- Object flushDependents.
- Object flushEvents.
 
+ ^self
+ snapshot: save
+ andQuit: quit
+ withExitCode: nil
+ embedded: embeddedFlag!
- (SourceFiles at: 2) ifNotNil:[
- msg := String streamContents: [ :s |
- s nextPutAll: '----';
- nextPutAll: (save ifTrue: [ quit ifTrue: [ 'QUIT' ] ifFalse: [ 'SNAPSHOT' ] ]
- ifFalse: [quit ifTrue: [ 'QUIT/NOSAVE' ] ifFalse: [ 'NOP' ]]);
- nextPutAll: '----';
- print: Date dateAndTimeNow; space;
- nextPutAll: (FileDirectory default localNameFor: self imageName);
- nextPutAll: ' priorSource: ';
- print: LastQuitLogPosition ].
- self assureStartupStampLogged.
- save ifTrue: [ LastQuitLogPosition := (SourceFiles at: 2) setToEnd; position ].
- self logChange: msg.
- Transcript cr; show: msg
- ].
-
- Smalltalk processShutDownList: quit.
- Cursor write show.
- save ifTrue: [resuming := embeddedFlag
- ifTrue: [self snapshotEmbeddedPrimitive]
- ifFalse: [self snapshotPrimitive].  "<-- PC frozen here on image file"
- resuming == false "guard against failure" ifTrue:
- ["Time to reclaim segment files is immediately after a save"
- Smalltalk at: #ImageSegment
- ifPresent: [:theClass | theClass reclaimObsoleteSegmentFiles]]]
- ifFalse: [resuming := false].
- quit & (resuming == false) ifTrue: [self quitPrimitive].
- Cursor normal show.
- Smalltalk setGCParameters.
- resuming == true ifTrue: [Smalltalk clearExternalObjects].
- Smalltalk processStartUpList: resuming == true.
- resuming == true ifTrue:[
- self setPlatformPreferences.
- self recordStartupStamp].
- Project current wakeUpTopWindow.
- "Now it's time to raise an error"
- resuming == nil ifTrue: [self error:'Failed to write image file (disk full?)'].
- ^ resuming!

Item was added:
+ ----- Method: SmalltalkImage>>snapshot:andQuit:withExitCode:embedded: (in category 'snapshot and quit') -----
+ snapshot: save andQuit: quit withExitCode: exitCode embedded: embeddedFlag
+ "Mark the changes file and close all files as part of #processShutdownList.
+ If save is true, save the current state of this Smalltalk in the image file.
+ If quit is true, then exit to the outer OS shell.
+ If exitCode is not nil, then use it as exit code.
+ The latter part of this method runs when resuming a previously saved image. This resume logic checks for a document file to process when starting up."
+
+ | resuming msg |
+ Object flushDependents.
+ Object flushEvents.
+
+ (SourceFiles at: 2) ifNotNil:[
+ msg := String streamContents: [ :s |
+ s nextPutAll: '----';
+ nextPutAll: (save ifTrue: [ quit ifTrue: [ 'QUIT' ] ifFalse: [ 'SNAPSHOT' ] ]
+ ifFalse: [quit ifTrue: [ 'QUIT/NOSAVE' ] ifFalse: [ 'NOP' ]]);
+ nextPutAll: '----';
+ print: Date dateAndTimeNow; space;
+ nextPutAll: (FileDirectory default localNameFor: self imageName);
+ nextPutAll: ' priorSource: ';
+ print: LastQuitLogPosition ].
+ self assureStartupStampLogged.
+ save ifTrue: [ LastQuitLogPosition := (SourceFiles at: 2) setToEnd; position ].
+ self logChange: msg.
+ Transcript cr; show: msg
+ ].
+
+ Smalltalk processShutDownList: quit.
+ Cursor write show.
+ save ifTrue: [resuming := embeddedFlag
+ ifTrue: [self snapshotEmbeddedPrimitive]
+ ifFalse: [self snapshotPrimitive].  "<-- PC frozen here on image file"
+ resuming == false "guard against failure" ifTrue:
+ ["Time to reclaim segment files is immediately after a save"
+ Smalltalk at: #ImageSegment
+ ifPresent: [:theClass | theClass reclaimObsoleteSegmentFiles]]]
+ ifFalse: [resuming := false].
+ quit & (resuming == false) ifTrue: [
+ exitCode
+ ifNil: [ self quitPrimitive ]
+ ifNotNil: [ self quitPrimitive: exitCode ] ].
+ Cursor normal show.
+ Smalltalk setGCParameters.
+ resuming == true ifTrue: [Smalltalk clearExternalObjects].
+ Smalltalk processStartUpList: resuming == true.
+ resuming == true ifTrue:[
+ self setPlatformPreferences.
+ self recordStartupStamp].
+ Project current wakeUpTopWindow.
+ "Now it's time to raise an error"
+ resuming == nil ifTrue: [self error:'Failed to write image file (disk full?)'].
+ ^ resuming!

Item was added:
+ ----- Method: SmalltalkImage>>snapshot:andQuitWithExitCode: (in category 'snapshot and quit') -----
+ snapshot: save andQuitWithExitCode: exitCode
+
+ ^self
+ snapshot: save
+ andQuit: true
+ withExitCode: exitCode
+ embedded: false!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ul.528.mcz

Frank Shearar-3
On 12 May 2013 21:35,  <[hidden email]> wrote:

> A new version of System was added to project The Inbox:
> http://source.squeak.org/inbox/System-ul.528.mcz
>
> ==================== Summary ====================
>
> Name: System-ul.528
> Author: ul
> Time: 12 May 2013, 10:33:50.489 pm
> UUID: d59743da-b5a5-4413-81f4-eb6dd7f7704d
> Ancestors: System-fbs.527
>
> Added support for defining the exit code when quitting.
>
> =============== Diff against System-fbs.527 ===============

ORSM! So I just need to say

SmalltalkImage current snapshot: false andQuitWithExitCode: 1

to signal a failure. Thanks!

frank

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ul.528.mcz

Levente Uzonyi-2
On Sun, 12 May 2013, Frank Shearar wrote:

> On 12 May 2013 21:35,  <[hidden email]> wrote:
>> A new version of System was added to project The Inbox:
>> http://source.squeak.org/inbox/System-ul.528.mcz
>>
>> ==================== Summary ====================
>>
>> Name: System-ul.528
>> Author: ul
>> Time: 12 May 2013, 10:33:50.489 pm
>> UUID: d59743da-b5a5-4413-81f4-eb6dd7f7704d
>> Ancestors: System-fbs.527
>>
>> Added support for defining the exit code when quitting.
>>
>> =============== Diff against System-fbs.527 ===============
>
> ORSM! So I just need to say
>
> SmalltalkImage current snapshot: false andQuitWithExitCode: 1
>
> to signal a failure. Thanks!

That's the idea, but you should use 'Smalltalk' instead of 'SmalltalkImage
current'.


Levente

>
> frank
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ul.528.mcz

Frank Shearar-3
On 12 May 2013 22:09, Levente Uzonyi <[hidden email]> wrote:

> On Sun, 12 May 2013, Frank Shearar wrote:
>
>> On 12 May 2013 21:35,  <[hidden email]> wrote:
>>>
>>> A new version of System was added to project The Inbox:
>>> http://source.squeak.org/inbox/System-ul.528.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: System-ul.528
>>> Author: ul
>>> Time: 12 May 2013, 10:33:50.489 pm
>>> UUID: d59743da-b5a5-4413-81f4-eb6dd7f7704d
>>> Ancestors: System-fbs.527
>>>
>>> Added support for defining the exit code when quitting.
>>>
>>> =============== Diff against System-fbs.527 ===============
>>
>>
>> ORSM! So I just need to say
>>
>> SmalltalkImage current snapshot: false andQuitWithExitCode: 1
>>
>> to signal a failure. Thanks!
>
>
> That's the idea, but you should use 'Smalltalk' instead of 'SmalltalkImage
> current'.

Yep, turns out I already do that in the scripts. I'd be happy to see
this in trunk!

frank

> Levente
>
>>
>> frank
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ul.528.mcz

Frank Shearar-3
In reply to this post by Levente Uzonyi-2
I'd really like to see this in trunk. If you used an interpreter vm, it just looks like you'd exit, just not with the desired exit code?

frank

On 12 May 2013, at 22:09, Levente Uzonyi <[hidden email]> wrote:

> On Sun, 12 May 2013, Frank Shearar wrote:
>
>> On 12 May 2013 21:35,  <[hidden email]> wrote:
>>> A new version of System was added to project The Inbox:
>>> http://source.squeak.org/inbox/System-ul.528.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: System-ul.528
>>> Author: ul
>>> Time: 12 May 2013, 10:33:50.489 pm
>>> UUID: d59743da-b5a5-4413-81f4-eb6dd7f7704d
>>> Ancestors: System-fbs.527
>>>
>>> Added support for defining the exit code when quitting.
>>>
>>> =============== Diff against System-fbs.527 ===============
>>
>> ORSM! So I just need to say
>>
>> SmalltalkImage current snapshot: false andQuitWithExitCode: 1
>>
>> to signal a failure. Thanks!
>
> That's the idea, but you should use 'Smalltalk' instead of 'SmalltalkImage current'.
>
>
> Levente
>
>>
>> frank
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ul.528.mcz

Levente Uzonyi-2
On Fri, 13 Sep 2013, Frank Shearar wrote:

> I'd really like to see this in trunk. If you used an interpreter vm, it just looks like you'd exit, just not with the desired exit code?

I can't check now, but I think the interpreter VM still doesn't support
the new primitive.


Levente

>
> frank
>
> On 12 May 2013, at 22:09, Levente Uzonyi <[hidden email]> wrote:
>
>> On Sun, 12 May 2013, Frank Shearar wrote:
>>
>>> On 12 May 2013 21:35,  <[hidden email]> wrote:
>>>> A new version of System was added to project The Inbox:
>>>> http://source.squeak.org/inbox/System-ul.528.mcz
>>>>
>>>> ==================== Summary ====================
>>>>
>>>> Name: System-ul.528
>>>> Author: ul
>>>> Time: 12 May 2013, 10:33:50.489 pm
>>>> UUID: d59743da-b5a5-4413-81f4-eb6dd7f7704d
>>>> Ancestors: System-fbs.527
>>>>
>>>> Added support for defining the exit code when quitting.
>>>>
>>>> =============== Diff against System-fbs.527 ===============
>>>
>>> ORSM! So I just need to say
>>>
>>> SmalltalkImage current snapshot: false andQuitWithExitCode: 1
>>>
>>> to signal a failure. Thanks!
>>
>> That's the idea, but you should use 'Smalltalk' instead of 'SmalltalkImage current'.
>>
>>
>> Levente
>>
>>>
>>> frank
>>>
>>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: System-ul.528.mcz

Frank Shearar-3
On 14 Sep 2013, at 0:23, Levente Uzonyi <[hidden email]> wrote:

> On Fri, 13 Sep 2013, Frank Shearar wrote:
>
>> I'd really like to see this in trunk. If you used an interpreter vm, it just looks like you'd exit, just not with the desired exit code?
>
> I can't check now, but I think the interpreter VM still doesn't support the new primitive.

Yes. I think I saw the primitiveFailed call after that and imagined that on the Interpreter that would result in 'try its best' behaviour, simply quitting without a set error code.

But worst comes to worst, if it's in trunk it's easier for me to use it from a script.

frank

> Levente
>
>>
>> frank
>>
>> On 12 May 2013, at 22:09, Levente Uzonyi <[hidden email]> wrote:
>>
>>> On Sun, 12 May 2013, Frank Shearar wrote:
>>>
>>>> On 12 May 2013 21:35,  <[hidden email]> wrote:
>>>>> A new version of System was added to project The Inbox:
>>>>> http://source.squeak.org/inbox/System-ul.528.mcz
>>>>>
>>>>> ==================== Summary ====================
>>>>>
>>>>> Name: System-ul.528
>>>>> Author: ul
>>>>> Time: 12 May 2013, 10:33:50.489 pm
>>>>> UUID: d59743da-b5a5-4413-81f4-eb6dd7f7704d
>>>>> Ancestors: System-fbs.527
>>>>>
>>>>> Added support for defining the exit code when quitting.
>>>>>
>>>>> =============== Diff against System-fbs.527 ===============
>>>>
>>>> ORSM! So I just need to say
>>>>
>>>> SmalltalkImage current snapshot: false andQuitWithExitCode: 1
>>>>
>>>> to signal a failure. Thanks!
>>>
>>> That's the idea, but you should use 'Smalltalk' instead of 'SmalltalkImage current'.
>>>
>>>
>>> Levente
>>>
>>>>
>>>> frank
>>>>
>>>>
>>>
>>
>>
>