12673
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1998 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
"{ Package: 'stx:libbasic' }"
|
|
13 |
|
3925
|
14 |
Object subclass:#Win32Process
|
|
15 |
instanceVariableNames:'command environment directory inStream outStream errorStream pid
|
|
16 |
exitStatus finishSema'
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'OS-Windows'
|
|
20 |
!
|
|
21 |
|
12673
|
22 |
!Win32Process class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
copyright
|
|
25 |
"
|
|
26 |
COPYRIGHT (c) 1998 by eXept Software AG
|
|
27 |
All Rights Reserved
|
|
28 |
|
|
29 |
This software is furnished under a license and may be used
|
|
30 |
only in accordance with the terms of that license and with the
|
|
31 |
inclusion of the above copyright notice. This software may not
|
|
32 |
be provided or otherwise made available to, or used by, any
|
|
33 |
other person. No title to or ownership of the software is
|
|
34 |
hereby transferred.
|
|
35 |
"
|
|
36 |
! !
|
3925
|
37 |
|
|
38 |
!Win32Process methodsFor:'accessing'!
|
|
39 |
|
|
40 |
command
|
|
41 |
"return the value of the instance variable 'command' (automatically generated)"
|
|
42 |
|
|
43 |
^ command
|
|
44 |
|
|
45 |
"Created: / 10.11.1998 / 21:27:07 / cg"
|
|
46 |
!
|
|
47 |
|
|
48 |
command:something
|
|
49 |
"set the value of the instance variable 'command' (automatically generated)"
|
|
50 |
|
|
51 |
command := something.
|
|
52 |
|
|
53 |
"Created: / 10.11.1998 / 21:27:07 / cg"
|
|
54 |
!
|
|
55 |
|
|
56 |
directory
|
|
57 |
"return the value of the instance variable 'directory' (automatically generated)"
|
|
58 |
|
|
59 |
^ directory
|
|
60 |
|
|
61 |
"Created: / 10.11.1998 / 21:21:52 / cg"
|
|
62 |
!
|
|
63 |
|
|
64 |
directory:something
|
|
65 |
"set the value of the instance variable 'directory' (automatically generated)"
|
|
66 |
|
|
67 |
directory := something.
|
|
68 |
|
|
69 |
"Created: / 10.11.1998 / 21:21:52 / cg"
|
|
70 |
!
|
|
71 |
|
|
72 |
environment
|
|
73 |
"return the value of the instance variable 'environment' (automatically generated)"
|
|
74 |
|
|
75 |
^ environment
|
|
76 |
|
|
77 |
"Created: / 10.11.1998 / 21:26:34 / cg"
|
|
78 |
!
|
|
79 |
|
|
80 |
environment:something
|
|
81 |
"set the value of the instance variable 'environment' (automatically generated)"
|
|
82 |
|
|
83 |
environment := something.
|
|
84 |
|
|
85 |
"Created: / 10.11.1998 / 21:27:07 / cg"
|
|
86 |
!
|
|
87 |
|
|
88 |
errorStream
|
|
89 |
"return the value of the instance variable 'errorStream' (automatically generated)"
|
|
90 |
|
|
91 |
^ errorStream
|
|
92 |
|
|
93 |
"Created: / 10.11.1998 / 21:26:34 / cg"
|
|
94 |
!
|
|
95 |
|
|
96 |
errorStream:something
|
|
97 |
"set the value of the instance variable 'errorStream' (automatically generated)"
|
|
98 |
|
|
99 |
errorStream := something.
|
|
100 |
|
|
101 |
"Created: / 10.11.1998 / 21:26:34 / cg"
|
|
102 |
!
|
|
103 |
|
|
104 |
exitStatus
|
|
105 |
"return the value of the instance variable 'exitStatus' (automatically generated)"
|
|
106 |
|
|
107 |
^ exitStatus
|
|
108 |
|
|
109 |
"Created: / 10.11.1998 / 21:24:55 / cg"
|
|
110 |
!
|
|
111 |
|
|
112 |
exitStatus:something
|
|
113 |
"set the value of the instance variable 'exitStatus' (automatically generated)"
|
|
114 |
|
|
115 |
exitStatus := something.
|
|
116 |
|
|
117 |
"Created: / 10.11.1998 / 21:24:55 / cg"
|
|
118 |
!
|
|
119 |
|
|
120 |
finishSema
|
|
121 |
"return the value of the instance variable 'finishSema' (automatically generated)"
|
|
122 |
|
|
123 |
^ finishSema
|
|
124 |
|
|
125 |
"Created: / 10.11.1998 / 21:21:53 / cg"
|
|
126 |
!
|
|
127 |
|
|
128 |
finishSema:something
|
|
129 |
"set the value of the instance variable 'finishSema' (automatically generated)"
|
|
130 |
|
|
131 |
finishSema := something.
|
|
132 |
|
|
133 |
"Created: / 10.11.1998 / 21:21:53 / cg"
|
|
134 |
!
|
|
135 |
|
|
136 |
inStream
|
|
137 |
"return the value of the instance variable 'inStream' (automatically generated)"
|
|
138 |
|
|
139 |
^ inStream
|
|
140 |
|
|
141 |
"Created: / 10.11.1998 / 21:26:34 / cg"
|
|
142 |
!
|
|
143 |
|
|
144 |
inStream:something
|
|
145 |
"set the value of the instance variable 'inStream' (automatically generated)"
|
|
146 |
|
|
147 |
inStream := something.
|
|
148 |
|
|
149 |
"Created: / 10.11.1998 / 21:26:34 / cg"
|
|
150 |
!
|
|
151 |
|
|
152 |
outStream
|
|
153 |
"return the value of the instance variable 'outStream' (automatically generated)"
|
|
154 |
|
|
155 |
^ outStream
|
|
156 |
|
|
157 |
"Created: / 10.11.1998 / 21:26:34 / cg"
|
|
158 |
!
|
|
159 |
|
|
160 |
outStream:something
|
|
161 |
"set the value of the instance variable 'outStream' (automatically generated)"
|
|
162 |
|
|
163 |
outStream := something.
|
|
164 |
|
|
165 |
"Created: / 10.11.1998 / 21:26:34 / cg"
|
|
166 |
!
|
|
167 |
|
|
168 |
pid
|
|
169 |
"return the value of the instance variable 'pid' (automatically generated)"
|
|
170 |
|
|
171 |
^ pid
|
|
172 |
|
|
173 |
"Created: / 10.11.1998 / 21:21:53 / cg"
|
|
174 |
!
|
|
175 |
|
|
176 |
pid:something
|
|
177 |
"set the value of the instance variable 'pid' (automatically generated)"
|
|
178 |
|
|
179 |
pid := something.
|
|
180 |
|
|
181 |
"Created: / 10.11.1998 / 21:21:53 / cg"
|
|
182 |
! !
|
|
183 |
|
|
184 |
!Win32Process methodsFor:'starting'!
|
|
185 |
|
|
186 |
startProcess
|
|
187 |
finishSema := Semaphore new.
|
|
188 |
|
|
189 |
pid := Processor
|
|
190 |
monitor:[
|
|
191 |
OperatingSystem
|
|
192 |
startProcess:command
|
|
193 |
inputFrom:inStream
|
|
194 |
outputTo:outStream
|
|
195 |
errorTo:errorStream
|
|
196 |
inDirectory:directory.
|
|
197 |
]
|
|
198 |
action:[:status |
|
|
199 |
status stillAlive ifFalse:[
|
|
200 |
exitStatus := status.
|
14986
|
201 |
"/ paranoia?
|
|
202 |
OperatingSystem terminateProcessGroup:pid.
|
|
203 |
OperatingSystem terminateProcess:pid.
|
3925
|
204 |
OperatingSystem closePid:pid.
|
|
205 |
finishSema signal
|
|
206 |
].
|
|
207 |
].
|
|
208 |
|
|
209 |
pid isNil ifTrue:[
|
14986
|
210 |
exitStatus := OperatingSystem osProcessStatusClass processCreationFailure.
|
3925
|
211 |
^ false
|
|
212 |
].
|
|
213 |
|
|
214 |
^ true.
|
|
215 |
|
|
216 |
"Created: / 10.11.1998 / 21:23:50 / cg"
|
|
217 |
"Modified: / 10.11.1998 / 21:33:16 / cg"
|
|
218 |
! !
|
|
219 |
|
|
220 |
!Win32Process class methodsFor:'documentation'!
|
|
221 |
|
|
222 |
version
|
14986
|
223 |
^ '$Header: /cvs/stx/stx/libbasic/Win32Process.st,v 1.3 2013-03-27 18:19:55 cg Exp $'
|
12673
|
224 |
!
|
|
225 |
|
|
226 |
version_CVS
|
14986
|
227 |
^ '$Header: /cvs/stx/stx/libbasic/Win32Process.st,v 1.3 2013-03-27 18:19:55 cg Exp $'
|
3925
|
228 |
! !
|
14986
|
229 |
|