EtiennePerot/fuse-jna — pull request #38 by stevebriskin (2014-05-01 22:37:29+00:00)
Title: Remove race condition when reading process output

The `getStderr()` and `getStdout()` calls wait for the process to finish but not for the output to be read. This results in methods returning prematurely with a `null` (about 2% of the time on my machine).

This race condition impacts setting current uid and gid in FuseJna.init() and results in files being owned by root rather than the user.

To reproduce:
```
public static void main(final String args[]) throws Exception
{
int nullCount = 0;
for (int i = 0; i < 1000; i++) {
if (new ProcessGobbler("id", "-u").getStdout() == null) {
nullCount++;
}
}
System.out.println(nullCount);
}
```