* eval.c (rb_f_exit), process.c (rb_f_exit_bang): treat true as
success, false as failure. [ruby-dev:22067] * eval.c (rb_f_abort, rb_thread_switch), process.c (rb_f_system): use ANSI macro instead of hard coded value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
868d5ba485
commit
99fb5f4871
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,11 @@
|
|||
Fri Nov 28 00:34:44 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_f_exit), process.c (rb_f_exit_bang): treat true as
|
||||
success, false as failure. [ruby-dev:22067]
|
||||
|
||||
* eval.c (rb_f_abort, rb_thread_switch), process.c (rb_f_system): use
|
||||
ANSI macro instead of hard coded value.
|
||||
|
||||
Thu Nov 27 22:05:48 2003 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* eval.c, gc.c: FreeBSD/ia64 currently does not have a way for a
|
||||
|
@ -8,8 +16,8 @@ Thu Nov 27 22:05:48 2003 Akinori MUSHA <knu@iDaemons.org>
|
|||
Thu Nov 27 17:36:42 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tkafter.rb: bug fix on TkTimer#cancel_on_exception=(mode).
|
||||
TkTimer#wait recieves the exception of the callback.
|
||||
The exception is kept on @return_value.
|
||||
TkTimer#wait recieves the exception of the callback.
|
||||
The exception is kept on @return_value.
|
||||
|
||||
Thu Nov 27 16:58:48 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
|
@ -77,7 +85,7 @@ Tue Nov 25 16:41:33 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
|||
Tue Nov 25 16:24:42 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* lib/soap/**/*.rb, lib/wsdl/**/*.rb, lib/xsd/**/*.rb: changed license;
|
||||
GPL2 -> Ruby's.
|
||||
GPL2 -> Ruby's.
|
||||
|
||||
* lib/soap/rpc/driver.rb, lib/soap/wsdlDriver.rb,
|
||||
lib/soap/streamHandler.rb: add interface to streamhandler.
|
||||
|
|
16
eval.c
16
eval.c
|
@ -3895,7 +3895,17 @@ rb_f_exit(argc, argv)
|
|||
|
||||
rb_secure(4);
|
||||
if (rb_scan_args(argc, argv, "01", &status) == 1) {
|
||||
istatus = NUM2INT(status);
|
||||
switch (status) {
|
||||
case T_TRUE:
|
||||
istatus = EXIT_SUCCESS;
|
||||
break;
|
||||
case T_FALSE:
|
||||
istatus = EXIT_FAILURE;
|
||||
break;
|
||||
default:
|
||||
istatus = NUM2INT(status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
istatus = EXIT_SUCCESS;
|
||||
|
@ -3922,7 +3932,7 @@ rb_f_abort(argc, argv)
|
|||
rb_scan_args(argc, argv, "1", &mesg);
|
||||
StringValue(argv[0]);
|
||||
rb_io_puts(argc, argv, rb_stderr);
|
||||
terminate_process(1, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
|
||||
terminate_process(EXIT_FAILURE, RSTRING(argv[0])->ptr, RSTRING(argv[0])->len);
|
||||
}
|
||||
return Qnil; /* not reached */
|
||||
}
|
||||
|
@ -8407,7 +8417,7 @@ rb_thread_switch(n)
|
|||
ruby_errinfo = th_raise_argv[0];
|
||||
ruby_current_node = th_raise_node;
|
||||
error_print();
|
||||
terminate_process(1, 0, 0);
|
||||
terminate_process(EXIT_FAILURE, 0, 0);
|
||||
break;
|
||||
case RESTORE_NORMAL:
|
||||
default:
|
||||
|
|
|
@ -94,7 +94,7 @@ module Test
|
|||
retry
|
||||
rescue
|
||||
end
|
||||
abort if @red
|
||||
exit !@red
|
||||
end
|
||||
|
||||
def stop(*) # :nodoc:
|
||||
|
|
|
@ -406,7 +406,7 @@ module Test
|
|||
retry
|
||||
rescue
|
||||
end
|
||||
abort if @red
|
||||
exit !@red
|
||||
end # def start_ui
|
||||
private :start_ui
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ module Test
|
|||
retry
|
||||
rescue
|
||||
end
|
||||
abort if @red
|
||||
exit !@red
|
||||
end
|
||||
|
||||
def stop # :nodoc:
|
||||
|
|
33
process.c
33
process.c
|
@ -30,6 +30,9 @@
|
|||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef EXIT_SUCCESS
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
#ifndef EXIT_FAILURE
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
@ -878,7 +881,17 @@ rb_f_exit_bang(argc, argv, obj)
|
|||
|
||||
rb_secure(4);
|
||||
if (rb_scan_args(argc, argv, "01", &status) == 1) {
|
||||
istatus = NUM2INT(status);
|
||||
switch (status) {
|
||||
case T_TRUE:
|
||||
istatus = EXIT_SUCCESS;
|
||||
break;
|
||||
case T_FALSE:
|
||||
istatus = EXIT_FAILURE;
|
||||
break;
|
||||
default:
|
||||
istatus = NUM2INT(status);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
istatus = EXIT_FAILURE;
|
||||
|
@ -930,9 +943,9 @@ rb_f_system(argc, argv)
|
|||
int argc;
|
||||
VALUE *argv;
|
||||
{
|
||||
int status;
|
||||
#if defined(__EMX__)
|
||||
VALUE cmd;
|
||||
int status;
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
@ -952,12 +965,8 @@ rb_f_system(argc, argv)
|
|||
SafeStringValue(cmd);
|
||||
status = do_spawn(RSTRING(cmd)->ptr);
|
||||
last_status_set(status, 0);
|
||||
|
||||
if (status == 0) return Qtrue;
|
||||
return Qfalse;
|
||||
#elif defined(__human68k__) || defined(__DJGPP__) || defined(_WIN32)
|
||||
volatile VALUE prog = 0;
|
||||
int status;
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
@ -990,10 +999,8 @@ rb_f_system(argc, argv)
|
|||
#else
|
||||
last_status_set(status == -1 ? 127 : status, 0);
|
||||
#endif
|
||||
return status == 0 ? Qtrue : Qfalse;
|
||||
#elif defined(__VMS)
|
||||
VALUE cmd;
|
||||
int status;
|
||||
|
||||
if (argc == 0) {
|
||||
rb_last_status = Qnil;
|
||||
|
@ -1011,9 +1018,6 @@ rb_f_system(argc, argv)
|
|||
SafeStringValue(cmd);
|
||||
status = system(RSTRING(cmd)->ptr);
|
||||
last_status_set((status & 0xff) << 8, 0);
|
||||
|
||||
if (status == 0) return Qtrue;
|
||||
return Qfalse;
|
||||
#else
|
||||
volatile VALUE prog = 0;
|
||||
int pid;
|
||||
|
@ -1064,10 +1068,11 @@ rb_f_system(argc, argv)
|
|||
rb_syswait(pid);
|
||||
}
|
||||
|
||||
if (NUM2INT(rb_last_status) == 0)
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
status = NUM2INT(rb_last_status);
|
||||
#endif
|
||||
|
||||
if (status == EXIT_SUCCESS) return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Reference in New Issue