Use correct handle when detecthing console on windows.

This commit is contained in:
Adam Murdoch
2012-10-10 16:51:02 +11:00
parent 827387dd78
commit 2fb75c790c

View File

@@ -128,7 +128,7 @@ Java_net_rubygrapefruit_platform_internal_jni_PosixFileSystemFunctions_listFileS
*/ */
HANDLE getHandle(JNIEnv *env, int output, jobject result) { HANDLE getHandle(JNIEnv *env, int output, jobject result) {
HANDLE handle = output == 1 ? GetStdHandle(STD_OUTPUT_HANDLE) : GetStdHandle(STD_ERROR_HANDLE); HANDLE handle = output == 0 ? GetStdHandle(STD_OUTPUT_HANDLE) : GetStdHandle(STD_ERROR_HANDLE);
if (handle == INVALID_HANDLE_VALUE) { if (handle == INVALID_HANDLE_VALUE) {
mark_failed_with_errno(env, "could not get console handle", result); mark_failed_with_errno(env, "could not get console handle", result);
return NULL; return NULL;