OSProcess use in Metacello2 for Pharo

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

OSProcess use in Metacello2 for Pharo

EstebanLM
Hi Dale,

I saw this:

   | in out err proc archive zipfile errorFileName|
   "Make a unique name for the error log and ensure that we can write the files"
   errorFileName := self downloadErrorFileNameFor: outputFileName.
   in := (' -L ' , url) readStream.
   out := FileStream forceNewFileNamed: outputFileName.
   err := FileStream forceNewFileNamed: errorFileName.
   proc := OSProcess thisOSProcess
       forkJob: '/usr/bin/curl'
       arguments:
           {'-L'.
           url}
       environment: nil
       descriptors: (Array with: nil with: out with: err).
   proc ifNil: [ OSProcess noAccessorAvailable ].
   [ proc isRunning ] whileTrue: [ (Delay forMilliseconds: 100) wait ].
   out close.
   err close.
   archive := ZipArchive new.
   zipfile := outputFileName asFileReference.
   zipfile readStreamDo: [ :fileStream | archive readFrom: fileStream ].
   ^ archive

and I have concerns about:
- it will never work on windows.
- it assumes certain files installed.
- it assumes a path for the installations.

I know it would be slower, but a solution using Zinc and ZipArchive would fit a lot better in the problem you are trying to solve there.
And we would reduce a dependence over OSProcess too.

(also, I needed to rollback the inclusion of Metacello2 into Pharo because of this)

--
You received this message because you are subscribed to the Google Groups "Metacello" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: OSProcess use in Metacello2 for Pharo

Dale Henrichs-3
Esteban,

Good points.

Using curl was an interim measure. When this code was written, it was a magic process to get SSL correctly installed with your vm and I really couldn't easily automate the process from within the image ...

I think that for Pharo3.0 and possibly Pharo2.0 Zinc could/should be used ... there is a caveat that at the time I was doing this, the Smalltalk unzip of the archive (another part of the process) was very slow and I ended up using unzip which would suffer from the same issues...

Dale

----- Original Message -----
| From: "Esteban Lorenzano" <[hidden email]>
| To: [hidden email]
| Sent: Wednesday, September 18, 2013 9:33:23 AM
| Subject: [Metacello] OSProcess use in Metacello2 for Pharo
|
| Hi Dale,
|
| I saw this:
|
|    | in out err proc archive zipfile errorFileName|
|    "Make a unique name for the error log and ensure that we can write
|    the files"
|    errorFileName := self downloadErrorFileNameFor: outputFileName.
|    in := (' -L ' , url) readStream.
|    out := FileStream forceNewFileNamed: outputFileName.
|    err := FileStream forceNewFileNamed: errorFileName.
|    proc := OSProcess thisOSProcess
|        forkJob: '/usr/bin/curl'
|        arguments:
|            {'-L'.
|            url}
|        environment: nil
|        descriptors: (Array with: nil with: out with: err).
|    proc ifNil: [ OSProcess noAccessorAvailable ].
|    [ proc isRunning ] whileTrue: [ (Delay forMilliseconds: 100) wait
|    ].
|    out close.
|    err close.
|    archive := ZipArchive new.
|    zipfile := outputFileName asFileReference.
|    zipfile readStreamDo: [ :fileStream | archive readFrom: fileStream
|    ].
|    ^ archive
|
| and I have concerns about:
| - it will never work on windows.
| - it assumes certain files installed.
| - it assumes a path for the installations.
|
| I know it would be slower, but a solution using Zinc and ZipArchive
| would fit a lot better in the problem you are trying to solve there.
| And we would reduce a dependence over OSProcess too.
|
| (also, I needed to rollback the inclusion of Metacello2 into Pharo
| because of this)
|
| --
| You received this message because you are subscribed to the Google
| Groups "Metacello" group.
| To unsubscribe from this group and stop receiving emails from it,
| send an email to [hidden email].
| For more options, visit https://groups.google.com/groups/opt_out.
|

--
You received this message because you are subscribed to the Google Groups "Metacello" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: OSProcess use in Metacello2 for Pharo

Dale Henrichs-3
Haha, I see that Christophe has already taken action and issued some pull requests with the code for using Zinc...

Dale

----- Original Message -----
| From: "Dale K. Henrichs" <[hidden email]>
| To: [hidden email]
| Sent: Monday, September 23, 2013 7:58:23 AM
| Subject: Re: [Metacello] OSProcess use in Metacello2 for Pharo
|
| Esteban,
|
| Good points.
|
| Using curl was an interim measure. When this code was written, it was
| a magic process to get SSL correctly installed with your vm and I
| really couldn't easily automate the process from within the image
| ...
|
| I think that for Pharo3.0 and possibly Pharo2.0 Zinc could/should be
| used ... there is a caveat that at the time I was doing this, the
| Smalltalk unzip of the archive (another part of the process) was
| very slow and I ended up using unzip which would suffer from the
| same issues...
|
| Dale
|
| ----- Original Message -----
| | From: "Esteban Lorenzano" <[hidden email]>
| | To: [hidden email]
| | Sent: Wednesday, September 18, 2013 9:33:23 AM
| | Subject: [Metacello] OSProcess use in Metacello2 for Pharo
| |
| | Hi Dale,
| |
| | I saw this:
| |
| |    | in out err proc archive zipfile errorFileName|
| |    "Make a unique name for the error log and ensure that we can
| |    write
| |    the files"
| |    errorFileName := self downloadErrorFileNameFor: outputFileName.
| |    in := (' -L ' , url) readStream.
| |    out := FileStream forceNewFileNamed: outputFileName.
| |    err := FileStream forceNewFileNamed: errorFileName.
| |    proc := OSProcess thisOSProcess
| |        forkJob: '/usr/bin/curl'
| |        arguments:
| |            {'-L'.
| |            url}
| |        environment: nil
| |        descriptors: (Array with: nil with: out with: err).
| |    proc ifNil: [ OSProcess noAccessorAvailable ].
| |    [ proc isRunning ] whileTrue: [ (Delay forMilliseconds: 100)
| |    wait
| |    ].
| |    out close.
| |    err close.
| |    archive := ZipArchive new.
| |    zipfile := outputFileName asFileReference.
| |    zipfile readStreamDo: [ :fileStream | archive readFrom:
| |    fileStream
| |    ].
| |    ^ archive
| |
| | and I have concerns about:
| | - it will never work on windows.
| | - it assumes certain files installed.
| | - it assumes a path for the installations.
| |
| | I know it would be slower, but a solution using Zinc and ZipArchive
| | would fit a lot better in the problem you are trying to solve
| | there.
| | And we would reduce a dependence over OSProcess too.
| |
| | (also, I needed to rollback the inclusion of Metacello2 into Pharo
| | because of this)
| |
| | --
| | You received this message because you are subscribed to the Google
| | Groups "Metacello" group.
| | To unsubscribe from this group and stop receiving emails from it,
| | send an email to [hidden email].
| | For more options, visit https://groups.google.com/groups/opt_out.
| |
|
| --
| You received this message because you are subscribed to the Google
| Groups "Metacello" group.
| To unsubscribe from this group and stop receiving emails from it,
| send an email to [hidden email].
| For more options, visit https://groups.google.com/groups/opt_out.
|

--
You received this message because you are subscribed to the Google Groups "Metacello" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.