Use Sleep under mingw rather than sleep (which is obsolete), and try using fork under cygwin (it should work by now, shurely...).