Skip to content

Conversation

Mihara
Copy link

@Mihara Mihara commented Nov 24, 2018

Fixes #1

After some near-blind mucking around, I managed to do it myself, so here's the PR.

Probably a very overkill way to do it, but seeing as how I know next to no Golang, it's surprising I got it working at all.

Probably a very overkill way to do it, but seeing as how I know
next to no Golang, it's surprising I got it working at all.
What's even more surprising is that the aficionados report using various
stupid hacks to deal with it: globally replacing paths, working on code
directly where go get downloaded it, splitting a unit into sub-repositories
when other projects are never supposed to import it piecewise, etc, etc.

Seeing as how my pull request resulted in no reaction from the original
developer, I'm adopting this, and let's make it a learning experience. For
starters, let's merge it into one package.
I've noticed that occasionally, commands whose only job is to send a PUB
message to another channel do not execute, especially if multiple messages
triggering them arrive in quick succession. It appears that due to all the
goroutines floating around, it is possible for os.exec.Wait to complete before
inputHandler actually gets to do anything to the pipe -- and Wait does not
appear to wait for the pipe to be closed on both ends too, so commands can get
lost entirely or even fail because the pipe was already closed.

Waiting for the inputHandler to complete appears to fix the issue.

Concurrency, fun for the whole family.
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.

1 participant