Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to run multiple io.process.Process objects simultaneously #157

Merged
merged 1 commit into from Apr 2, 2016

Conversation

myaut
Copy link
Contributor

@myaut myaut commented Mar 17, 2016

Currently, Process incorrectly handles stdout/stderr channels which rely on
global state:

  • static methods used to handle read/close events are instantiated on
    module import. Thus, they are being mocked by addHandler() which sets
    .channel to them. Starting a new process causes resetting that field
    on the global method objects, thus all processes will receive output
    from the last started process. To mitigate this, static methods are
    replaced with closure-like lambdas.
  • Process incorrectly raises stopped() event to close stdout/stderr. This
    event, however, is used to signal Manager's death. Thus, when process is
    completed, all sockets/pipes in the entire program are closed. This is why
    stopped() event has to be replaced with process-specific terminated() event
    and we need explicitly send close() to all process pipes.

Currently, Process incorrectly handles stdout/stderr channels which rely on
global state:
  - static methods used to handle read/close events are instantiated on
    module import. Thus, they are being mocked by addHandler() which sets
    .channel to them. Starting a new process causes resetting that field
    on the global method objects, thus all processes will receive output
    from the last started process. To mitigate this, static methods are
    replaced with closure-like lambdas.
  - Process incorrectly raises stopped() event to close stdout/stderr. This
    event, however, is used to signal Manager's death. Thus, when process is
    completed, all sockets/pipes in the entire program are closed. This is why
    stopped() event has to be replaced with process-specific terminated() event
    and we need explicitly send close() to all process pipes.
@spaceone
Copy link
Contributor

Can't the static methods be replaced by real methods?

@prologic
Copy link
Member

@myaut I'l buy this :) Thanks! I guess on-one has really used the Process component to run simultaneous background processes before; weird :)

@prologic prologic merged commit 884b071 into circuits:master Apr 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants