Fix valgrind issues.
Work around OSX and Cygwin signal issues.
Skip valgrind on OSX because it's experimental and doesn't fully work yet.