summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-01 08:44:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-01 08:44:44 +0000
commit05bc15b0ecab56b0e930a4608e49b81764817b11 (patch)
treea1ab02481bcb4bcc86f9f6e0dc87f77d50372a03
parent8424cec21ccf71d90cfc4ea07afdd7e46e63d40f (diff)
* win32/win32.c (init_stdhandle): assign standard file handles.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--win32/win32.c22
2 files changed, 26 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 98a54eb..11ec374 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Tue Aug 01 17:44:03 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (init_stdhandle): assign standard file handles.
+
Tue Aug 1 12:24:58 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (Init_Binding): fix old commit miss.
diff --git a/win32/win32.c b/win32/win32.c
index 2cadc57..e8ac1bb 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -360,6 +360,8 @@ flock(int fd, int oper)
(DWORD)-1);
}
+static void init_stdhandle(void);
+
#if _MSC_VER >= 1400
static void invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t dummy)
{
@@ -407,6 +409,8 @@ NtInitialize(int *argc, char ***argv)
tzset();
+ init_stdhandle();
+
atexit(exit_handler);
// Initialize Winsock
@@ -1695,11 +1699,29 @@ rb_w32_open_osfhandle(long osfhandle, int flags)
}
return fh; /* return handle */
}
+
+static void
+init_stdhandle(void)
+{
+ if (fileno(stdin) < 0) {
+ stdin->_file = 0;
+ }
+ if (fileno(stdout) < 0) {
+ stdout->_file = 1;
+ }
+ if (fileno(stderr) < 0) {
+ stderr->_file = 2;
+ }
+}
#else
#define _set_osfhnd(fh, osfh) (void)((fh), (osfh))
#define _set_osflags(fh, flags) (void)((fh), (flags))
+static void
+init_stdhandle(void)
+{
+}
#endif
#ifdef __BORLANDC__