[squeak-dev] OSProcess stdErr issue on Windows

Ben Coman btc at openInWorld.com
Sun Jan 11 04:36:14 UTC 2015


On Windows 7, trying to execute a non-existent program as follows...
    OSProcess command: 'notepadXX.exe'

...causes an MNU in ExternalWindowsOSProcess>>value. This is due to writing
to stderr where "self initialStdErr" returns nil, seemingly due to
ExternalWindowsOSProcess missing the #initialize and #setDefaults of E
xternalUnixOSProcess.

Now I understand that stderr is problematic in general on Windows.
The following statements...
    OSProcess thisOSProcess stdErr nextPutAll: 'test'.
   FileStream stderr nextPutAll: 'test'.

...both work fine on OSX, but fail on Windows with the error
"FileWriteError: File stderr is closed"
The result is the same on both Pharo 4 and Squeak 4.5.
(Squeak also brings up a bottom message bar saying... "# To disable: F2 ->
'debug options' -> 'show console on errors' WARNING: Manufactured file
handle detected!")

Pharo has a workaround for the general issue by creating a disk file
named 'stderr'
as follows...
    FileStream class >> standardIOStreamNamed: moniker forWrite: forWrite
self flag: #todo. "This is an ugly hack, while waiting for a real fix for
windows. There  several problems with this approach, but it allow us to run
tests, etc."
Smalltalk os isWin32
ifTrue: [
[ ^ MultiByteFileStream forceNewFileNamed: moniker asString ]
on: CannotDeleteFileException do: [
"HACK: if the image is opened a second time windows barks about the already
opened locked file"
^ MultiByteFileStream forceNewFileNamed: moniker asString, '_', (Random new
nextInt: SmallInteger maxVal) asString   ]].

So to address the MNU for OSProcess?
1. wrap the "self initialStdErr" with an #ifNil: check
2. Squeak adopt the Pharo workaround, then lean on that to define
#initialize and #setDefaults for ExternalWindowsOSProcess
3. real fix for stderr (outside of OSProcess?)
4. wont fix
5. other?


Note that this is not a burning issue for me. I am just cleaning out old
issues that I logged in the Pharo bug tracker.  If the answer if (4.)  I'll
just close the issue [1].


For both Squeak and Pharo, I
loaded ConfigurationOfOSProcess-ThierryGoubier.33 from...
    MCHttpRepository
location: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo40/main'
(Perhaps someone with access can copy that to the main repo)


cheers -ben

[1] https://pharo.fogbugz.com/default.asp?11615
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20150111/3df726bc/attachment.htm


More information about the Squeak-dev mailing list