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

Wait for subprocess and exit with same return code #177

Merged
merged 2 commits into from
Jan 7, 2019

Conversation

mcg1969
Copy link
Collaborator

@mcg1969 mcg1969 commented Jan 6, 2019

Fixes #154.
Rebases #158; original text from there:


Not sure how this made it through this long, but the current behavior is a pretty awful experience: random interleaved outputs (#154), broken usage when scripted, and failures not being caught.

Can work up a proper test if necessary... basically a project file like:

commands:
  a:
    windows: timeout 1 && echo a
  b:
    windows: echo b

then

anaconda-project run a
anaconda-project run b

would yield

b # immediately
a # after a second

and should yield

a # after a second
b # immediately

@bollwyvl
Copy link
Contributor

bollwyvl commented Jan 7, 2019

I probably can't update on this, but it looks like this might do the trick:

def mock_popen(args, env, cwd, shell):
    executed['args'] = args
    executed['env'] = env
    executed['cwd'] = cwd
    executed['shell'] = shell

    class MockProcess(object):
        def wait(self):
            return 0

    return MockProcess()

@mcg1969
Copy link
Collaborator Author

mcg1969 commented Jan 7, 2019

Thanks Nick!

@bollwyvl
Copy link
Contributor

bollwyvl commented Jan 7, 2019

Godspeed! Thanks for picking up all these pieces: I've been using project a lot and this is really the only thing I've had to maintain a patch for.

@mcg1969
Copy link
Collaborator Author

mcg1969 commented Jan 7, 2019

That's great to hear. It has several internal fans as well and it was high time it got the love it deserves.

@mcg1969 mcg1969 merged commit 89f7c74 into anaconda:master Jan 7, 2019
@mcg1969 mcg1969 deleted the wait-for-exit branch January 7, 2019 02:49
@bollwyvl
Copy link
Contributor

bollwyvl commented Jan 7, 2019

Hooray!

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

2 participants