support std input handle, tweak win32 version for pipes