JohnSundell / ShellOut

Easily run shell commands from a Swift script or command line tool
MIT License
872 stars 85 forks source link

Synchronize reads/writes to outputData and errorData #25

Closed harlanhaskins closed 6 years ago

harlanhaskins commented 6 years ago

Since the FileHandle readabilityHandlers execute asyncronously, possibly on multiple different queues, we need to guard the reads/writes of the outputData/errorData on a serial dispatch queue, and block until all writes have finished.

harlanhaskins commented 6 years ago

This fixes the bug I observed with Lite's parallel test runner. TSan runs clean with this fix.

harlanhaskins commented 6 years ago

Thanks for the merge! Mind doing another tag on master so I can update https://github.com/silt-lang/Lite's Package.swift?

JohnSundell commented 6 years ago

Sure, will do 👍

JohnSundell commented 6 years ago

And it's me who should thank you for contributing ;)

JohnSundell commented 6 years ago

Done! https://github.com/JohnSundell/ShellOut/releases/tag/2.1.0