Use wait2 to get exit status
Merge pull request #15 from xymbol/use-wait2

Use wait2 to get exit status