OSProcess.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 09 Apr 2011 18:19:04 +0100
branchjv
changeset 17834 04ff72c5039a
parent 17814 b75a7f0c346b
child 17841 7abcc4aef871
permissions -rw-r--r--
Merged with /trunk

"
 COPYRIGHT (c) 2006 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libbasic' }"

Object subclass:#OSProcess
	instanceVariableNames:'pid parentPid commandLine'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Support'
!

!OSProcess class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2006 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    OSProcess is an abstract class. Instances represent operating system processes
    (as opposed to Smalltalk processes).

    [author:]
        Stefan Vogel (stefan@zwerg)

    [instance variables:]
        pid         SmallInteger    the process id
        parentPid   SmallInteger    the process id of the parent process
        commandLine String          the command line of the running command.

    [class variables:]

    [see also:]
        Process

"
! !

!OSProcess methodsFor:'accessing'!

commandLine
    ^ commandLine
!

commandLine:something
    commandLine := something.
!

parentPid
    ^ parentPid
!

parentPid:something
    parentPid := something.
!

pid
    ^ pid
!

pid:something
    pid := something.
! !

!OSProcess methodsFor:'printing'!

printOn:aStream
    aStream 
        nextPutAll:self className;
        nextPut:$(.
    pid printOn:aStream.
    aStream space.
    commandLine printOn:aStream.
    aStream nextPut:$)
! !

!OSProcess methodsFor:'queries'!

getProcessHandle
    "some OperatingSystems redefine this to resolve this to a processHandle
     (which must be explicitely freed later).
     Others simply return the pid here"

    ^ self subclassResponsibility
!

isAlive
    "answer true, if the process is still alive"

    ^ self subclassResponsibility
!

isDead
    "answer true, if the process is no longer alive"

    ^ self isAlive not
! !

!OSProcess methodsFor:'terminating'!

kill
    "kill the process - the process does not get the chance to clean up"
    
    ^ self subclassResponsibility.
!

killGroup
    "killl the processGroup - the processes does not get the chance to clean up"
    
    ^ self subclassResponsibility.
!

killWithAllChildren
    "terminate gracefully the process with all of its child processes"

    ^ self subclassResponsibility.
!

terminate
    "terminate the process gracefully"

    ^ self subclassResponsibility.
!

terminateGroup
    "terminate the process group.
     Under Windows, these is the same as terminateWithhAllChildren,
     under unix, this terminates a subset of all children"

   ^ self subclassResponsibility.
!

terminateWithAllChildren
    "terminate gracefully the process with all of its child processes"

    ^ self subclassResponsibility.
! !

!OSProcess class methodsFor:'documentation'!

version_CVS
    ^ 'Header: /var/local/cvs/stx/libbasic/OSProcess.st,v 1.2 2011-03-08 17:01:30 stefan Exp '
!

version_SVN
    ^ '$Id$'
! !