--- a/Win32OperatingSystem.st Mon Apr 18 21:28:36 2011 +0200
+++ b/Win32OperatingSystem.st Tue Apr 19 11:04:01 2011 +0200
@@ -3324,48 +3324,48 @@
"Internal lowLevel entry for combined fork & exec for WIN32
If fork is false (chain a command):
- execute the OS command specified by the argument, aCommandPath, with
- arguments in argArray (no arguments, if nil).
- If successful, this method does not return and smalltalk is gone.
- If not successful, it does return.
- Normal use is with forkForCommand.
+ execute the OS command specified by the argument, aCommandPath, with
+ arguments in argArray (no arguments, if nil).
+ If successful, this method does not return and smalltalk is gone.
+ If not successful, it does return.
+ Normal use is with forkForCommand.
If fork is true (subprocess command execution):
- fork a child to do the above.
- The Win32ProcessHandle of the child process is returned; nil if the fork failed.
+ fork a child to do the above.
+ The Win32ProcessHandle of the child process is returned; nil if the fork failed.
fdArray contains the filedescriptors, to be used for the child (if fork is true).
- fdArray[1] = 15 -> use fd 15 as stdin.
- If an element of the array is set to nil, the corresponding filedescriptor
- will be closed for the child.
- fdArray[0] == StdIn for child
- fdArray[1] == StdOut for child
- fdArray[2] == StdErr for child
- on VMS, these must be channels as returned by createMailBox.
+ fdArray[1] = 15 -> use fd 15 as stdin.
+ If an element of the array is set to nil, the corresponding filedescriptor
+ will be closed for the child.
+ fdArray[0] == StdIn for child
+ fdArray[1] == StdOut for child
+ fdArray[2] == StdErr for child
+ on VMS, these must be channels as returned by createMailBox.
NOTE that in WIN32 the fds are HANDLES.
If newPgrp is true, the subprocess will be established in a new process group.
- The processgroup will be equal to id.
- newPgrp is not used on WIN32 and VMS systems."
+ The processgroup will be equal to id.
+ newPgrp is not used on WIN32 and VMS systems."
|dirPath rslt|
aDirectory notNil ifTrue:[
- dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
- (dirPath endsWith:':') ifTrue:[
- dirPath := dirPath , '\'.
- ].
+ dirPath := aDirectory asFilename asAbsoluteFilename osNameForDirectory.
+ (dirPath endsWith:':') ifTrue:[
+ dirPath := dirPath , '\'.
+ ].
].
rslt := self
- primExec:aCommandPath
- commandLine:argString
- fileDescriptors:fdArray
- fork:doFork
- newPgrp:newPgrp
- inPath:dirPath
- createFlags:nil.
+ primExec:aCommandPath
+ commandLine:argString
+ fileDescriptors:fdArray
+ fork:doFork
+ newPgrp:newPgrp
+ inPath:dirPath
+ createFlags:nil.
"/ 'created ' print. cmdLine print. ' -> ' print. rslt printCR.
^ rslt
@@ -3394,34 +3394,34 @@
|nullStream in out err rslt auxFd|
(in := anExternalInStream) isNil ifTrue:[
- nullStream := Filename nullDevice readWriteStream.
- in := nullStream.
+ nullStream := Filename nullDevice readWriteStream.
+ in := nullStream.
].
(out := anExternalOutStream) isNil ifTrue:[
- nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
- out := nullStream.
+ nullStream isNil ifTrue:[nullStream := Filename nullDevice writeStream].
+ out := nullStream.
].
(err := anExternalErrStream) isNil ifTrue:[
- err := out
+ err := out
].
anAuxiliaryStream notNil ifTrue:[
- auxFd := anAuxiliaryStream fileDescriptor
+ auxFd := anAuxiliaryStream fileDescriptor
].
rslt := self
- exec:commandString
- withArguments:argString
- environment:anEvironmentDictionary
- fileDescriptors:(Array with:in fileDescriptor
- with:out fileDescriptor
- with:err fileDescriptor
- with:auxFd)
- fork:true
- newPgrp:true "/ false
- inDirectory:dir.
+ exec:commandString
+ withArguments:argString
+ environment:anEvironmentDictionary
+ fileDescriptors:(Array with:in fileDescriptor
+ with:out fileDescriptor
+ with:err fileDescriptor
+ with:auxFd)
+ fork:true
+ newPgrp:true "/ false
+ inDirectory:dir.
nullStream notNil ifTrue:[
- nullStream close.
+ nullStream close.
].
^ rslt
@@ -3444,7 +3444,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -3869,10 +3869,10 @@
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
^ self
- exec:(shellAndArgs at:1) withArguments:(shellAndArgs at:2)
- inputFrom:anExternalInStream outputTo:anExternalOutStream
- errorTo:anExternalErrStream auxFrom:anAuxiliaryStream
- environment:anEvironmentDictionary inDirectory:dir
+ exec:(shellAndArgs at:1) withArguments:(shellAndArgs at:2)
+ inputFrom:anExternalInStream outputTo:anExternalOutStream
+ errorTo:anExternalErrStream auxFrom:anAuxiliaryStream
+ environment:anEvironmentDictionary inDirectory:dir
"blocking at current prio (i.e. only higher prio threads execute):
@@ -3893,7 +3893,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -4113,10 +4113,10 @@
Return true if successful, false if not."
(oldPath isString not or:[newPath isString not]) ifTrue:[
- "/
- "/ bad argument(s) given
- "/
- ^ self primitiveFailed
+ "/
+ "/ bad argument(s) given
+ "/
+ ^ self primitiveFailed
].
^ self createHardLinkFrom:oldPath to:newPath
@@ -8295,48 +8295,48 @@
int err;
if (__isExternalAddressLike(processHandleOrPid) ) {
- DWORD exitCode;
-
- processHandle = _HANDLEVal(processHandleOrPid);
-
- if (processHandle == 0) {
- error = @symbol(invalidParameter);
- } else {
- /* check if the handle still refers to a running process */
- if (GetExitCodeProcess(processHandle, &exitCode) != 0) {
- if (exitCode == STILL_ACTIVE) {
- RETURN(true);
- } else {
- RETURN(false);
- }
- } else {
- goto checkError;
- }
+ DWORD exitCode;
+
+ processHandle = _HANDLEVal(processHandleOrPid);
+
+ if (processHandle == 0) {
+ error = @symbol(invalidParameter);
+ } else {
+ /* check if the handle still refers to a running process */
+ if (GetExitCodeProcess(processHandle, &exitCode) != 0) {
+ if (exitCode == STILL_ACTIVE) {
+ RETURN(true);
+ } else {
+ RETURN(false);
+ }
+ } else {
+ goto checkError;
+ }
}
} else if( __isSmallInteger(processHandleOrPid) ) {
- // assume, that synchronize needs less privilege...
- processHandle = OpenProcess(SYNCHRONIZE, FALSE, __smallIntegerVal(processHandleOrPid));
- if (processHandle) {
- CloseHandle(processHandle);
- RETURN(true);
- }
+ // assume, that synchronize needs less privilege...
+ processHandle = OpenProcess(SYNCHRONIZE, FALSE, __smallIntegerVal(processHandleOrPid));
+ if (processHandle) {
+ CloseHandle(processHandle);
+ RETURN(true);
+ }
checkError:
- err = GetLastError();
- // we do not have access to the process (so pid does exist ;-))
- if (err == ERROR_ACCESS_DENIED) {
- RETURN(true);
- }
- // pid does not exist
- if (err == ERROR_INVALID_PARAMETER) {
- RETURN(false);
- }
-
- // any other error - raise signal
- __threadErrno = __WIN32_ERR(err);
- error = __mkSmallInteger(__threadErrno);
+ err = GetLastError();
+ // we do not have access to the process (so pid does exist ;-))
+ if (err == ERROR_ACCESS_DENIED) {
+ RETURN(true);
+ }
+ // pid does not exist
+ if (err == ERROR_INVALID_PARAMETER) {
+ RETURN(false);
+ }
+
+ // any other error - raise signal
+ __threadErrno = __WIN32_ERR(err);
+ error = __mkSmallInteger(__threadErrno);
} else {
- error = @symbol(invalidParameter);
+ error = @symbol(invalidParameter);
}
%}.
@@ -8704,22 +8704,22 @@
]
]
] ifFalse:[
- #(
- '\smalltalk'
- '\programme\smalltalk'
- '\programme\eXept\smalltalk'
- '\programs\smalltalk'
- '\programs\eXept\smalltalk'
- ) do:[:d | |dd|
- dd := d asFilename constructString:'packages'.
- (pPath includes:dd) ifFalse:[
- pPath add:dd.
- ].
- dd := (d asFilename construct:Smalltalk versionString) constructString:'packages'.
- (pPath includes:dd) ifFalse:[
- pPath add:dd.
- ].
- ].
+"/ #(
+"/ '\smalltalk'
+"/ '\programme\smalltalk'
+"/ '\programme\eXept\smalltalk'
+"/ '\programs\smalltalk'
+"/ '\programs\eXept\smalltalk'
+"/ ) do:[:d | |dd|
+"/ dd := d asFilename constructString:'packages'.
+"/ (pPath includes:dd) ifFalse:[
+"/ pPath add:dd.
+"/ ].
+"/ dd := (d asFilename construct:Smalltalk versionString) constructString:'packages'.
+"/ (pPath includes:dd) ifFalse:[
+"/ pPath add:dd.
+"/ ].
+"/ ].
].
"/ under windows, the commandName includes the path - good.
@@ -8753,27 +8753,27 @@
sysPath add:libDirPath
].
].
- #(
- '\programs\eXept\smalltalk'
- '\programme\eXept\smalltalk'
- '\programs\smalltalk'
- '\programme\smalltalk'
- '\smalltalk'
- ) do:[:dir |
- |vsnDir|
-
- (dir asFilename isDirectory) ifTrue:[
- vsnDir := dir , '\' , Smalltalk versionString.
- (vsnDir asFilename isDirectory) ifTrue:[
- (sysPath includes:vsnDir) ifFalse:[
- sysPath add:vsnDir.
- ]
- ].
- (sysPath includes:dir) ifFalse:[
- sysPath add:dir.
- ].
- ]
- ].
+"/ #(
+"/ '\programs\eXept\smalltalk'
+"/ '\programme\eXept\smalltalk'
+"/ '\programs\smalltalk'
+"/ '\programme\smalltalk'
+"/ '\smalltalk'
+"/ ) do:[:dir |
+"/ |vsnDir|
+"/
+"/ (dir asFilename isDirectory) ifTrue:[
+"/ vsnDir := dir , '\' , Smalltalk versionString.
+"/ (vsnDir asFilename isDirectory) ifTrue:[
+"/ (sysPath includes:vsnDir) ifFalse:[
+"/ sysPath add:vsnDir.
+"/ ]
+"/ ].
+"/ (sysPath includes:dir) ifFalse:[
+"/ sysPath add:dir.
+"/ ].
+"/ ]
+"/ ].
^ sysPath
@@ -9471,8 +9471,8 @@
dateFormat
"Answer the current system value for date format.
Answer DfMDY = Month-Day-Year
- DfDMY = Day-Month-Year
- DfYMD = Year-Month-Day."
+ DfDMY = Day-Month-Year
+ DfYMD = Year-Month-Day."
|separatorString code|
@@ -9672,22 +9672,22 @@
This looks for the files extension, and is typically used to present help-files,
html documents, pdf documents etc.
operationSymbol is one of:
- open
- edit
- explore
- print
+ open
+ edit
+ explore
+ print
"
|result filename|
filename := aFilenameOrString asFilename.
result := self
- shellExecute:nil
- lpOperation:operationSymbol
- lpFile:filename pathName
- lpParameters:nil
- lpDirectory:filename directory pathName
- nShowCmd:#SW_SHOWNORMAL.
+ shellExecute:nil
+ lpOperation:operationSymbol
+ lpFile:filename pathName
+ lpParameters:nil
+ lpDirectory:filename directory pathName
+ nShowCmd:#SW_SHOWNORMAL.
^ self.
"
@@ -13690,11 +13690,11 @@
idx := aKeyNamePath indexOf:(self separator).
idx == 0 ifTrue:[
- first := aKeyNamePath.
- rest := nil.
+ first := aKeyNamePath.
+ rest := nil.
] ifFalse:[
- first := aKeyNamePath copyTo:idx-1.
- rest := aKeyNamePath copyFrom:idx+1
+ first := aKeyNamePath copyTo:idx-1.
+ rest := aKeyNamePath copyFrom:idx+1
].
first := first asUppercase.
@@ -13702,17 +13702,17 @@
"/ the first is a pseudo name
root := self rootKey:first.
root isNil ifTrue:[
- ^ nil
+ ^ nil
].
rest size == 0 ifTrue:[
- ^ root
+ ^ root
].
Error handle:[:ex |
- ^ nil
+ ^ nil
] do:[
- ^ root subKeyNamed:rest createIfAbsent:createIfAbsent.
+ ^ root subKeyNamed:rest createIfAbsent:createIfAbsent.
].
"
@@ -14189,9 +14189,9 @@
|k|
(k := self subKeyNamed:subKeyString) isNil ifTrue:[
- createIfAbsent ifTrue:[
- ^ self createSubKeyNamed:subKeyString
- ].
+ createIfAbsent ifTrue:[
+ ^ self createSubKeyNamed:subKeyString
+ ].
].
^ k
@@ -14704,7 +14704,7 @@
"evaluate aBlock for all value names"
^ Array streamContents:[:s |
- self valueNamesDo:[:nm | s nextPut:nm]
+ self valueNamesDo:[:nm | s nextPut:nm]
].
"Created: / 18-01-2011 / 20:24:52 / cg"
@@ -16336,11 +16336,11 @@
!Win32OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.420 2011-03-28 15:10:10 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.421 2011-04-19 09:04:01 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.420 2011-03-28 15:10:10 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.421 2011-04-19 09:04:01 cg Exp $'
! !
Win32OperatingSystem initialize!