summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-04 01:17:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-04 01:17:34 +0000
commit1f9d0992aba18316b2e08ce2ce00b0b5eb524e48 (patch)
treed7c5bb12fb376dfe6b1d5ae65f840297d9b51a95
parent9c64c3ed5c45084e62f46fc6b5d80948697c3f86 (diff)
* io.c (pipe_open): raise NotImplementedError for command "-" on
platforms where fork(2) is not available. [ruby-dev:30681] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--io.c16
-rw-r--r--version.h6
3 files changed, 16 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index f0618e9712..57582a68ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
-Wed Apr 4 10:01:20 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 4 10:18:04 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* io.c (popen_exec): should not close close-on-exec FDs.
[ruby-dev:30679]
+ * io.c (pipe_open): raise NotImplementedError for command "-" on
+ platforms where fork(2) is not available. [ruby-dev:30681]
+
Tue Apr 4 04:17:18 2007 Technorama Ltd. <oss-ruby@technorama.net>
* ext/openssl/ossl_ssl.c: Add documentation.
diff --git a/io.c b/io.c
index b9a84e11e4..60bee39968 100644
--- a/io.c
+++ b/io.c
@@ -3059,11 +3059,11 @@ pipe_open(int argc, VALUE *argv, const char *mode)
#if defined(HAVE_FORK) && defined(HAVE_SOCKETPAIR)
int status;
struct popen_arg arg;
- volatile int doexec;
#elif defined(_WIN32)
int openmode = rb_io_mode_modenum(mode);
char *exename = NULL;
#endif
+ volatile int doexec;
char *cmd;
FILE *fp = 0;
int fd = -1;
@@ -3074,9 +3074,10 @@ pipe_open(int argc, VALUE *argv, const char *mode)
prog = argv[0];
}
-#if defined(HAVE_FORK) && defined(HAVE_SOCKETPAIR)
cmd = StringValueCStr(prog);
doexec = (strcmp("-", cmd) != 0);
+
+#if defined(HAVE_FORK) && defined(HAVE_SOCKETPAIR)
if (!doexec) {
fflush(stdin); /* is it really needed? */
rb_io_flush(rb_stdout);
@@ -3136,6 +3137,7 @@ pipe_open(int argc, VALUE *argv, const char *mode)
fd = arg.pair[1];
}
#elif defined(_WIN32)
+ if (!doexec) rb_notimplement();
if (argc) {
char **args = ALLOCA_N(char *, argc+1);
int i;
@@ -3148,9 +3150,6 @@ pipe_open(int argc, VALUE *argv, const char *mode)
rb_w32_join_argv(cmd, args);
exename = RSTRING_PTR(prog);
}
- else {
- cmd = StringValueCStr(prog);
- }
while ((pid = rb_w32_pipe_exec(cmd, exename, openmode, &fd)) == -1) {
/* exec failed */
switch (errno) {
@@ -3166,9 +3165,12 @@ pipe_open(int argc, VALUE *argv, const char *mode)
}
}
#else
- if (argc)
+ if (!doexec) rb_notimplement();
+ if (argc) {
prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
- fp = popen(StringValueCStr(prog), mode);
+ cmd = StringValueCStr(prog);
+ }
+ fp = popen(cmd, mode);
if (!fp) rb_sys_fail(RSTRING_PTR(prog));
fd = fileno(fp);
#endif
diff --git a/version.h b/version.h
index 593085ec82..9999671713 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2007-04-03"
+#define RUBY_RELEASE_DATE "2007-04-04"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20070403
+#define RUBY_RELEASE_CODE 20070404
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 4
-#define RUBY_RELEASE_DAY 3
+#define RUBY_RELEASE_DAY 4
RUBY_EXTERN const char ruby_version[];
RUBY_EXTERN const char ruby_release_date[];