[ANN] OSSubprocess first milestone

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

[ANN] OSSubprocess first milestone

Mariano Martinez Peck
Dear all, 

I am happy to tell you I have a first prototype of the tool for executing OS processes:


 As I said many times, the main idea was to be as much as possible FFI-based, only for executing OS commands and, from my point of view, a better end-user API. Also, as for the first step, I had to focus on Linux/OSX. 

I would like to thank Pharo Consortium for the sponsor of this development effort. Here is the first milestone!

There are many things on my to-do but I think the code is ready for some usage, testing, code review and feedback!  

All classes and all methods have comments and I have quite some unit tests. All tests are green in my OSX and a CentOS box. 

Important: you CANNOT have OSProcess installed in the same image as OSSubprocess. This is because I am reusing his SIGCHLD handler and for the time being both cannot coexist.  

Keep in mind that the tool may be unstable and that MAY mean a VM crash. So use with care, mostly the first time. If all tests passes, then there are much less chances of something going bad. 

Important disclaimer: my tool (OSSubproccess from now onward) is HIGHLY influenced by a subset of the OSProcess project. There are parts which I even simply copied and adapted them (OSSPipe, OSSAttachableStream, OSSUnixProcessExitStatus). Other parts, I took them as inspiration (the idea of ThisOSProcess representing the VM process, the child watcher, and many others). In addition, I AM STILL USING (maybe as a first step?) some of the OSProcess PLUGIN (not OSProcess image side), such as the SIGCHLD handler or the creation of pipes.

In github url you have all the documentation of the project, included how to install it and use it. 

Finally, if you test it in a OS different than OSX and CentOS please share with me the results (about the tests). Tomorrow the ConfigurationOf should also appear in the Catalog of Pharo 5.0. 

Any feedback is appreciated. 

Best, 

--
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

CyrilFerlicot
Le 14/01/2016 19:33, Mariano Martinez Peck a écrit :

> Dear all,
>
> I am happy to tell you I have a first prototype of the tool for
> executing OS processes:
>
> https://github.com/marianopeck/OSSubprocess
>
>  As I said many times, the main idea was to be as much as possible
> FFI-based, only for executing OS commands and, from my point of view, a
> better end-user API. Also, as for the first step, I had to focus on
> Linux/OSX.
>
> I would like to thank Pharo Consortium for the sponsor of this
> development effort. Here is the first milestone!
>
> There are many things on my to-do but I think the code is ready for some
> usage, testing, code review and feedback!  
>
> All classes and all methods have comments and I have quite some unit
> tests. All tests are green in my OSX and a CentOS box.
>
> *Important: you CANNOT have OSProcess installed in the same image as
> OSSubprocess. This is because I am reusing his SIGCHLD handler and for
> the time being both cannot coexist.  *
>
> Keep in mind that the tool may be unstable and that MAY mean a VM crash.
> So use with care, mostly the first time. If all tests passes, then there
> are much less chances of something going bad.
>
> Important disclaimer: my tool (OSSubproccess from now onward) is HIGHLY
> influenced by a subset of the OSProcess project. There are parts which I
> even simply copied and adapted them (OSSPipe, OSSAttachableStream,
> OSSUnixProcessExitStatus). Other parts, I took them as inspiration (the
> idea of ThisOSProcess representing the VM process, the child watcher,
> and many others). In addition, I AM STILL USING (maybe as a first step?)
> some of the OSProcess PLUGIN (not OSProcess image side), such as the
> SIGCHLD handler or the creation of pipes.
>
> In github url you have all the documentation of the project, included
> how to install it and use it.
>
> *Finally, if you test it in a OS different than OSX and CentOS please
> share with me the results (about the tests).* Tomorrow the
> ConfigurationOf should also appear in the Catalog of Pharo 5.0.
>
> Any feedback is appreciated.
>
> Best,
>
> --
> Mariano
> http://marianopeck.wordpress.com
Hi,

Thank you for your work!

In Windows seven I got an error on loading.

Executed code in Pharo 5:

Metacello new
    configuration: 'OSSubprocess';
    repository: 'github://marianopeck/OSSubprocess:master/repository';
    version: #stable;
    load.

Stack:

ExternalLibraryFunction(Object)>>error:
ExternalLibraryFunction(Object)>>externalCallFailed
ExternalLibraryFunction(ExternalFunction)>>invokeWithArguments:
OSSUnixSystemAccessor>>primitiveGetpid
FFICalloutAPI>>function:module:
OSSUnixSystemAccessor(Object)>>ffiCall:
OSSUnixSystemAccessor>>primitiveGetpid
OSSUnixSystemAccessor>>getPid
OSSVMProcess>>initialize
OSSVMProcess class>>initializeVMProcessInstance
OSSVMProcess class>>initialize
MCMethodDefinition>>postloadOver:
[ :each | each postloadOver: (self obsoletionFor: each) ] in
MCPackageLoader>>basicLoadDefinitions in Block: [ :each | each
postloadOver: (self obsoletionFor: ...etc...
[ :each |
| newLabel |
"Special handling for first and last element"
(count = 0
        or:
                [ count + 1 = size
                        or: [ (Time millisecondsSince: lastUpdate) >= msecs ] ])
        ifTrue:
                [ bar current: count.
                oldLabel = (newLabel := (labelBlock cull: each) ifNil: [ oldLabel ])
                        ifFalse: [ bar label: newLabel.
                                oldLabel := newLabel ].
                lastUpdate := Time millisecondClockValue ].
aBlock value: each.
count := count + 1 ] in [ :bar |
labelBlock := aStringOrBlock isString
        ifTrue: [ bar label: aStringOrBlock.
                [ :dummyItem | aStringOrBlock ] ]
        ifFalse: [ aStringOrBlock ].
self
        do:
                [ :each |
                | newLabel |
                "Special handling for first and last element"
                (count = 0
                        or:
                                [ count + 1 = size
                                        or: [ (Time millisecondsSince: lastUpdate) >= msecs ] ])
                        ifTrue:
                                [ bar current: count.
                                oldLabel
                                        = (newLabel := (labelBlock cull: each) ifNil: [ oldLabel ])
                                        ifFalse: [ bar label: newLabel.
                                                oldLabel := newLabel ].
                                lastUpdate := Time millisecondClockValue ].
                aBlock value: each.
                count := count + 1 ] ] in
OrderedCollection(Collection)>>do:displayingProgress:every: in Block: [
:each | ...
OrderedCollection>>do:
[ :bar |
labelBlock := aStringOrBlock isString
        ifTrue: [ bar label: aStringOrBlock.
                [ :dummyItem | aStringOrBlock ] ]
        ifFalse: [ aStringOrBlock ].
self
        do:
                [ :each |
                | newLabel |
                "Special handling for first and last element"
                (count = 0
                        or:
                                [ count + 1 = size
                                        or: [ (Time millisecondsSince: lastUpdate) >= msecs ] ])
                        ifTrue:
                                [ bar current: count.
                                oldLabel
                                        = (newLabel := (labelBlock cull: each) ifNil: [ oldLabel ])
                                        ifFalse: [ bar label: newLabel.
                                                oldLabel := newLabel ].
                                lastUpdate := Time millisecondClockValue ].
                aBlock value: each.
                count := count + 1 ] ] in
OrderedCollection(Collection)>>do:displayingProgress:every: in Block: [
:bar | ...
BlockClosure>>cull:
[ ^ block cull: self ] in [ self prepareForRunning.
CurrentJob value: self during: [ ^ block cull: self ] ] in Job>>run in
Block: [ ^ block cull: self ]
[ p psValueAt: index put: anObject.
aBlock value ] in CurrentJob(DynamicVariable)>>value:during: in Block: [
p psValueAt: index put: anObject....
BlockClosure>>ensure:
CurrentJob(DynamicVariable)>>value:during:
CurrentJob class(DynamicVariable class)>>value:during:
[ self prepareForRunning.
CurrentJob value: self during: [ ^ block cull: self ] ] in Job>>run in
Block: [ self prepareForRunning....
BlockClosure>>ensure:
Job>>run
MorphicUIManager(UIManager)>>displayProgress:from:to:during:
ByteString(String)>>displayProgressFrom:to:during:
OrderedCollection(Collection)>>do:displayingProgress:every:
OrderedCollection(Collection)>>do:displayingProgress:
MCPackageLoader>>basicLoadDefinitions



--
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France


signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Mariano Martinez Peck


On Thu, Jan 14, 2016 at 3:44 PM, Ferlicot D. Cyril <[hidden email]> wrote:
Le 14/01/2016 19:33, Mariano Martinez Peck a écrit :
> Dear all,
>
> I am happy to tell you I have a first prototype of the tool for
> executing OS processes:
>
> https://github.com/marianopeck/OSSubprocess
>
>  As I said many times, the main idea was to be as much as possible
> FFI-based, only for executing OS commands and, from my point of view, a
> better end-user API. Also, as for the first step, I had to focus on
> Linux/OSX.
>
> I would like to thank Pharo Consortium for the sponsor of this
> development effort. Here is the first milestone!
>
> There are many things on my to-do but I think the code is ready for some
> usage, testing, code review and feedback!
>
> All classes and all methods have comments and I have quite some unit
> tests. All tests are green in my OSX and a CentOS box.
>
> *Important: you CANNOT have OSProcess installed in the same image as
> OSSubprocess. This is because I am reusing his SIGCHLD handler and for
> the time being both cannot coexist.  *
>
> Keep in mind that the tool may be unstable and that MAY mean a VM crash.
> So use with care, mostly the first time. If all tests passes, then there
> are much less chances of something going bad.
>
> Important disclaimer: my tool (OSSubproccess from now onward) is HIGHLY
> influenced by a subset of the OSProcess project. There are parts which I
> even simply copied and adapted them (OSSPipe, OSSAttachableStream,
> OSSUnixProcessExitStatus). Other parts, I took them as inspiration (the
> idea of ThisOSProcess representing the VM process, the child watcher,
> and many others). In addition, I AM STILL USING (maybe as a first step?)
> some of the OSProcess PLUGIN (not OSProcess image side), such as the
> SIGCHLD handler or the creation of pipes.
>
> In github url you have all the documentation of the project, included
> how to install it and use it.
>
> *Finally, if you test it in a OS different than OSX and CentOS please
> share with me the results (about the tests).* Tomorrow the
> ConfigurationOf should also appear in the Catalog of Pharo 5.0.
>
> Any feedback is appreciated.
>
> Best,
>
> --
> Mariano
> http://marianopeck.wordpress.com

Hi,

Thank you for your work!

In Windows seven I got an error on loading.


Yes, sorry, no windows for the moment. 
Should work in OSX, Linux and other's Unix* as far as I can think of.

At some point we may unify an API with ProcessWrapper but not right now (at least from my side). 


 
Executed code in Pharo 5:

Metacello new
    configuration: 'OSSubprocess';
    repository: 'github://marianopeck/OSSubprocess:master/repository';
    version: #stable;
    load.

Stack:

ExternalLibraryFunction(Object)>>error:
ExternalLibraryFunction(Object)>>externalCallFailed
ExternalLibraryFunction(ExternalFunction)>>invokeWithArguments:
OSSUnixSystemAccessor>>primitiveGetpid
FFICalloutAPI>>function:module:
OSSUnixSystemAccessor(Object)>>ffiCall:
OSSUnixSystemAccessor>>primitiveGetpid
OSSUnixSystemAccessor>>getPid
OSSVMProcess>>initialize
OSSVMProcess class>>initializeVMProcessInstance
OSSVMProcess class>>initialize
MCMethodDefinition>>postloadOver:
[ :each | each postloadOver: (self obsoletionFor: each) ] in
MCPackageLoader>>basicLoadDefinitions in Block: [ :each | each
postloadOver: (self obsoletionFor: ...etc...
[ :each |
| newLabel |
"Special handling for first and last element"
(count = 0
        or:
                [ count + 1 = size
                        or: [ (Time millisecondsSince: lastUpdate) >= msecs ] ])
        ifTrue:
                [ bar current: count.
                oldLabel = (newLabel := (labelBlock cull: each) ifNil: [ oldLabel ])
                        ifFalse: [ bar label: newLabel.
                                oldLabel := newLabel ].
                lastUpdate := Time millisecondClockValue ].
aBlock value: each.
count := count + 1 ] in [ :bar |
labelBlock := aStringOrBlock isString
        ifTrue: [ bar label: aStringOrBlock.
                [ :dummyItem | aStringOrBlock ] ]
        ifFalse: [ aStringOrBlock ].
self
        do:
                [ :each |
                | newLabel |
                "Special handling for first and last element"
                (count = 0
                        or:
                                [ count + 1 = size
                                        or: [ (Time millisecondsSince: lastUpdate) >= msecs ] ])
                        ifTrue:
                                [ bar current: count.
                                oldLabel
                                        = (newLabel := (labelBlock cull: each) ifNil: [ oldLabel ])
                                        ifFalse: [ bar label: newLabel.
                                                oldLabel := newLabel ].
                                lastUpdate := Time millisecondClockValue ].
                aBlock value: each.
                count := count + 1 ] ] in
OrderedCollection(Collection)>>do:displayingProgress:every: in Block: [
:each | ...
OrderedCollection>>do:
[ :bar |
labelBlock := aStringOrBlock isString
        ifTrue: [ bar label: aStringOrBlock.
                [ :dummyItem | aStringOrBlock ] ]
        ifFalse: [ aStringOrBlock ].
self
        do:
                [ :each |
                | newLabel |
                "Special handling for first and last element"
                (count = 0
                        or:
                                [ count + 1 = size
                                        or: [ (Time millisecondsSince: lastUpdate) >= msecs ] ])
                        ifTrue:
                                [ bar current: count.
                                oldLabel
                                        = (newLabel := (labelBlock cull: each) ifNil: [ oldLabel ])
                                        ifFalse: [ bar label: newLabel.
                                                oldLabel := newLabel ].
                                lastUpdate := Time millisecondClockValue ].
                aBlock value: each.
                count := count + 1 ] ] in
OrderedCollection(Collection)>>do:displayingProgress:every: in Block: [
:bar | ...
BlockClosure>>cull:
[ ^ block cull: self ] in [ self prepareForRunning.
CurrentJob value: self during: [ ^ block cull: self ] ] in Job>>run in
Block: [ ^ block cull: self ]
[ p psValueAt: index put: anObject.
aBlock value ] in CurrentJob(DynamicVariable)>>value:during: in Block: [
p psValueAt: index put: anObject....
BlockClosure>>ensure:
CurrentJob(DynamicVariable)>>value:during:
CurrentJob class(DynamicVariable class)>>value:during:
[ self prepareForRunning.
CurrentJob value: self during: [ ^ block cull: self ] ] in Job>>run in
Block: [ self prepareForRunning....
BlockClosure>>ensure:
Job>>run
MorphicUIManager(UIManager)>>displayProgress:from:to:during:
ByteString(String)>>displayProgressFrom:to:during:
OrderedCollection(Collection)>>do:displayingProgress:every:
OrderedCollection(Collection)>>do:displayingProgress:
MCPackageLoader>>basicLoadDefinitions



--
Cyril Ferlicot

http://www.synectique.eu

165 Avenue Bretagne
Lille 59000 France




--
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] [ANN] OSSubprocess first milestone

David T. Lewis
In reply to this post by Mariano Martinez Peck
On Thu, Jan 14, 2016 at 03:33:56PM -0300, Mariano Martinez Peck wrote:

> Dear all,
>
> I am happy to tell you I have a first prototype of the tool for executing
> OS processes:
>
> https://github.com/marianopeck/OSSubprocess
>
>  As I said many times, the main idea was to be as much as possible
> FFI-based, only for executing OS commands and, from my point of view, a
> better end-user API. Also, as for the first step, I had to focus on
> Linux/OSX.
>
> I would like to thank Pharo Consortium for the sponsor of this development
> effort. Here is the first milestone!

Bravo Mariano!

Dave


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Damien Cassou-2
In reply to this post by Mariano Martinez Peck
On January 14, 2016 7:33:56 PM GMT+01:00, Mariano Martinez Peck <[hidden email]> wrote:

>Dear all,
>
>I am happy to tell you I have a first prototype of the tool for
>executing
>OS processes:
>
>https://github.com/marianopeck/OSSubprocess
>
> As I said many times, the main idea was to be as much as possible
>FFI-based, only for executing OS commands and, from my point of view, a
>better end-user API. Also, as for the first step, I had to focus on
>Linux/OSX.
>
>I would like to thank Pharo Consortium for the sponsor of this
>development
>effort. Here is the first milestone!
>
>There are many things on my to-do but I think the code is ready for
>some
>usage, testing, code review and feedback!
>
>All classes and all methods have comments and I have quite some unit
>tests.
>All tests are green in my OSX and a CentOS box.
>
>*Important: you CANNOT have OSProcess installed in the same image as
>OSSubprocess. This is because I am reusing his SIGCHLD handler and for
>the
>time being both cannot coexist.  *
>
>Keep in mind that the tool may be unstable and that MAY mean a VM
>crash. So
>use with care, mostly the first time. If all tests passes, then there
>are
>much less chances of something going bad.
>
>Important disclaimer: my tool (OSSubproccess from now onward) is HIGHLY
>influenced by a subset of the OSProcess project. There are parts which
>I
>even simply copied and adapted them (OSSPipe, OSSAttachableStream,
>OSSUnixProcessExitStatus). Other parts, I took them as inspiration (the
>idea of ThisOSProcess representing the VM process, the child watcher,
>and
>many others). In addition, I AM STILL USING (maybe as a first step?)
>some
>of the OSProcess PLUGIN (not OSProcess image side), such as the SIGCHLD
>handler or the creation of pipes.
>
>In github url you have all the documentation of the project, included
>how
>to install it and use it.
>
>*Finally, if you test it in a OS different than OSX and CentOS please
>share
>with me the results (about the tests).* Tomorrow the ConfigurationOf
>should
>also appear in the Catalog of Pharo 5.0.
>
>Any feedback is appreciated.
>
>Best,

Quick feedback:

- the API seems great
- thank you very much for the documentation
- I wonder why you pass strings for stdout and stderr instead of streams
- it would be nice to be able to subclass OSSUnixProcessExitStatus for some commands. E.g., GitProcessExitStatus could have a method isMergeConflict
- how can I implement something like tail --follow
--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Thierry Goubier
In reply to this post by Mariano Martinez Peck
And for those who would like to use it (or for Mac OS X users), a
GitFileTree version using it is available by loading it this way:

Metacello new
         baseline: 'FileTree';
         repository: 'github://dalehenrich/filetree:issue_171/repository';
         load: 'Git'

Regards,

Thierry

Le 14/01/2016 19:33, Mariano Martinez Peck a écrit :

> Dear all,
>
> I am happy to tell you I have a first prototype of the tool for
> executing OS processes:
>
> https://github.com/marianopeck/OSSubprocess
>
>   As I said many times, the main idea was to be as much as possible
> FFI-based, only for executing OS commands and, from my point of view, a
> better end-user API. Also, as for the first step, I had to focus on
> Linux/OSX.
>
> I would like to thank Pharo Consortium for the sponsor of this
> development effort. Here is the first milestone!
>
> There are many things on my to-do but I think the code is ready for some
> usage, testing, code review and feedback!
>
> All classes and all methods have comments and I have quite some unit
> tests. All tests are green in my OSX and a CentOS box.
>
> *Important: you CANNOT have OSProcess installed in the same image as
> OSSubprocess. This is because I am reusing his SIGCHLD handler and for
> the time being both cannot coexist. *
>
> Keep in mind that the tool may be unstable and that MAY mean a VM crash.
> So use with care, mostly the first time. If all tests passes, then there
> are much less chances of something going bad.
>
> Important disclaimer: my tool (OSSubproccess from now onward) is HIGHLY
> influenced by a subset of the OSProcess project. There are parts which I
> even simply copied and adapted them (OSSPipe, OSSAttachableStream,
> OSSUnixProcessExitStatus). Other parts, I took them as inspiration (the
> idea of ThisOSProcess representing the VM process, the child watcher,
> and many others). In addition, I AM STILL USING (maybe as a first step?)
> some of the OSProcess PLUGIN (not OSProcess image side), such as the
> SIGCHLD handler or the creation of pipes.
>
> In github url you have all the documentation of the project, included
> how to install it and use it.
>
> *Finally, if you test it in a OS different than OSX and CentOS please
> share with me the results (about the tests).* Tomorrow the
> ConfigurationOf should also appear in the Catalog of Pharo 5.0.
>
> Any feedback is appreciated.
>
> Best,
>
> --
> Mariano
> http://marianopeck.wordpress.com


Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Luc Fabresse
Hi Mariano,

Thanks to tackle and document these things!

I did not read all what you wrote yet, but do you have also the possibility to process stdout/stderr while the external process is running and not only on exit?

Something like:

OSSUnixSubprocess new   
    command: 'reallyLongToExecuteCommandWithLotsOfThingsOnStdout';
    redirectStdout;
    redirectStderr;
    runAndDo: [ :process :outStream :errStream | 
  "I can analyze outStream / errStream"
"and even show status to the user"
    ] each: 5 seconds;
    onExitDo: [ :process :outStream :errStream  |    
        "cleanup"
    ]

Cheers,

#Luc

2016-01-15 8:20 GMT+01:00 Thierry Goubier <[hidden email]>:
And for those who would like to use it (or for Mac OS X users), a GitFileTree version using it is available by loading it this way:

Metacello new
        baseline: 'FileTree';
        repository: 'github://dalehenrich/filetree:issue_171/repository';
        load: 'Git'

Regards,

Thierry

Le 14/01/2016 19:33, Mariano Martinez Peck a écrit :
Dear all,

I am happy to tell you I have a first prototype of the tool for
executing OS processes:

https://github.com/marianopeck/OSSubprocess

  As I said many times, the main idea was to be as much as possible
FFI-based, only for executing OS commands and, from my point of view, a
better end-user API. Also, as for the first step, I had to focus on
Linux/OSX.

I would like to thank Pharo Consortium for the sponsor of this
development effort. Here is the first milestone!

There are many things on my to-do but I think the code is ready for some
usage, testing, code review and feedback!

All classes and all methods have comments and I have quite some unit
tests. All tests are green in my OSX and a CentOS box.

*Important: you CANNOT have OSProcess installed in the same image as
OSSubprocess. This is because I am reusing his SIGCHLD handler and for
the time being both cannot coexist. *

Keep in mind that the tool may be unstable and that MAY mean a VM crash.
So use with care, mostly the first time. If all tests passes, then there
are much less chances of something going bad.

Important disclaimer: my tool (OSSubproccess from now onward) is HIGHLY
influenced by a subset of the OSProcess project. There are parts which I
even simply copied and adapted them (OSSPipe, OSSAttachableStream,
OSSUnixProcessExitStatus). Other parts, I took them as inspiration (the
idea of ThisOSProcess representing the VM process, the child watcher,
and many others). In addition, I AM STILL USING (maybe as a first step?)
some of the OSProcess PLUGIN (not OSProcess image side), such as the
SIGCHLD handler or the creation of pipes.

In github url you have all the documentation of the project, included
how to install it and use it.

*Finally, if you test it in a OS different than OSX and CentOS please
share with me the results (about the tests).* Tomorrow the
ConfigurationOf should also appear in the Catalog of Pharo 5.0.

Any feedback is appreciated.

Best,

--
Mariano
http://marianopeck.wordpress.com



Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Damien Cassou-2
In reply to this post by Mariano Martinez Peck
On January 14, 2016 7:33:56 PM GMT+01:00, Mariano Martinez Peck <[hidden email]> wrote:

>Dear all,
>
>I am happy to tell you I have a first prototype of the tool for
>executing
>OS processes:
>
>https://github.com/marianopeck/OSSubprocess
>
> As I said many times, the main idea was to be as much as possible
>FFI-based, only for executing OS commands and, from my point of view, a
>better end-user API. Also, as for the first step, I had to focus on
>Linux/OSX.
>
>I would like to thank Pharo Consortium for the sponsor of this
>development
>effort. Here is the first milestone!
>
>There are many things on my to-do but I think the code is ready for
>some
>usage, testing, code review and feedback!
>
>All classes and all methods have comments and I have quite some unit
>tests.
>All tests are green in my OSX and a CentOS box.
>
>*Important: you CANNOT have OSProcess installed in the same image as
>OSSubprocess. This is because I am reusing his SIGCHLD handler and for
>the
>time being both cannot coexist.  *
>
>Keep in mind that the tool may be unstable and that MAY mean a VM
>crash. So
>use with care, mostly the first time. If all tests passes, then there
>are
>much less chances of something going bad.
>
>Important disclaimer: my tool (OSSubproccess from now onward) is HIGHLY
>influenced by a subset of the OSProcess project. There are parts which
>I
>even simply copied and adapted them (OSSPipe, OSSAttachableStream,
>OSSUnixProcessExitStatus). Other parts, I took them as inspiration (the
>idea of ThisOSProcess representing the VM process, the child watcher,
>and
>many others). In addition, I AM STILL USING (maybe as a first step?)
>some
>of the OSProcess PLUGIN (not OSProcess image side), such as the SIGCHLD
>handler or the creation of pipes.
>
>In github url you have all the documentation of the project, included
>how
>to install it and use it.
>
>*Finally, if you test it in a OS different than OSX and CentOS please
>share
>with me the results (about the tests).* Tomorrow the ConfigurationOf
>should
>also appear in the Catalog of Pharo 5.0.
>
>Any feedback is appreciated.
>
>Best,

defaultReadStreamCreationBlock: [ process createTempFileToBeUsedAsReadStreamOn: '/tmp' ];

In the readme, the piece of code containing that is a bit suspicious because it depends on the fact that the block is evaluated after the variable 'process' is assigned.
--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Mariano Martinez Peck
In reply to this post by Damien Cassou-2

Quick feedback:

- the API seems great
- thank you very much for the documentation

Thanks!
 
- I wonder why you pass strings for stdout and stderr instead of streams

In which part exactly? In the method like #runAndWaitOnExitDo: ? 
if that was the question, then I simply thought it would be easier for the user to receive strings. In fact, internally I use streams, but just when I evaluate the closure I pass #contents.  I think it's more common for users wanting a string than a stream. In either case, if they received a string they can do #readStreamDo:[]  or whatever, and if they receive a stream they can do #contents. 
 
- it would be nice to be able to subclass OSSUnixProcessExitStatus for some commands. E.g., GitProcessExitStatus could have a method isMergeConflict

That would be nice. 
 
- how can I implement something like tail --follow

I think it would be nice to how an example of this type of streaming API. Note that this goes very similar to what Luc proposes below. 

Thanks for the feedback!


--
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Mariano Martinez Peck
In reply to this post by Damien Cassou-2


defaultReadStreamCreationBlock: [ process createTempFileToBeUsedAsReadStreamOn: '/tmp' ];

In the readme, the piece of code containing that is a bit suspicious because it depends on the fact that the block is evaluated after the variable 'process' is assigned.

Thanks, fixed!
 I always hated the instance side nature of those methods, so I moved them to class side.


 
--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill




--
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

Mariano Martinez Peck
Luc, Damien, et all.

I implemented the kind of API Luc suggested, which was a great idea. I took also his API to answer Damien question of could we do a "tail -f" example. So I made a little example where I run "tail -f system.log" and I keep a Playground updated with the stdout :)
Here is the video:


Let me know what do you think.

Cheers,


On Fri, Jan 15, 2016 at 10:51 AM, Mariano Martinez Peck <[hidden email]> wrote:


defaultReadStreamCreationBlock: [ process createTempFileToBeUsedAsReadStreamOn: '/tmp' ];

In the readme, the piece of code containing that is a bit suspicious because it depends on the fact that the block is evaluated after the variable 'process' is assigned.

Thanks, fixed!
 I always hated the instance side nature of those methods, so I moved them to class side.


 
--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill




--



--
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] OSSubprocess first milestone

jfabry

That looks very cool to me, it would have come quite in handy for some project that I did last year ;-)

On Jan 15, 2016, at 13:13, Mariano Martinez Peck <[hidden email]> wrote:

Luc, Damien, et all.

I implemented the kind of API Luc suggested, which was a great idea. I took also his API to answer Damien question of could we do a "tail -f" example. So I made a little example where I run "tail -f system.log" and I keep a Playground updated with the stdout :)
Here is the video:


Let me know what do you think.

Cheers,



---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile