llgs local: fix missing target rerun issue.

Net result: I wasn't waiting for enough execs.  It looks like
/bin/sh execs twice on Linux, like bash, zsh and a few others
do on Darwin.

Fixes https://github.com/tfiala/lldb/issues/54.

Related to https://github.com/tfiala/lldb/issues/57.

Notably does not fix https://github.com/tfiala/lldb/issues/56,
which leads me to believe issues/57 still isn't handled right.

This change also incorporates a few of Stephane's patches
from upstream since they were relevant for llgs.