Skip to content

Properly kill background testrpc instance#445

Merged
frangio merged 1 commit into
OpenZeppelin:masterfrom
frangio:fix-leftover-testrpc
Sep 18, 2017
Merged

Properly kill background testrpc instance#445
frangio merged 1 commit into
OpenZeppelin:masterfrom
frangio:fix-leftover-testrpc

Conversation

@frangio

@frangio frangio commented Sep 14, 2017

Copy link
Copy Markdown
Contributor

Fixes #431.

@cgewecke

Copy link
Copy Markdown
Contributor

@frangio Out of curiosity - could you describe what the bug was here?

@frangio

frangio commented Sep 14, 2017

Copy link
Copy Markdown
Contributor Author

@cgewecke Definitely!

The original script ran testrpc in the background, basically doing testrpc & and immediately afterwards saving the PID by testrpc_pid=$! to be able to kill it afterwards.

I merged testing and coverage scripts in #369, by defining a bash function called testrpc which would run the original or the instrumented instance depending on an environment variable. So now it was this function which was being run in the background by doing testrpc &. Running a function in the background is accomplished by running a new bash process in the background. Because of this our testrpc_pid variable then had the pid of the bash process. We were killing the bash process and not its testrpc child, leaving it orphaned.

I fixed it by moving around the &, so as to not run the function in the background and correctly get testrpc_pid.

@cgewecke

Copy link
Copy Markdown
Contributor

Ah! Awesome, thanks @frangio.

@frangio frangio merged commit f60c5ad into OpenZeppelin:master Sep 18, 2017
@frangio frangio deleted the fix-leftover-testrpc branch September 18, 2017 18:54
ProphetDaniel pushed a commit to classicdelta/Smart-Contracts that referenced this pull request Mar 9, 2018
Properly kill background testrpc instance
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.

2 participants