зеркало из https://github.com/github/ruby.git
* io.c (pipe_open): erred program name should be reported by
exceptions, instead of the first argument. * process.c (rb_spawn): ditto. * process.c (proc_spawn_v): use first argument as program name. * win32/win32.c (rb_w32_aspawn): ditto. * win32/win32.c (CreateChild): search executable file if no program name given. * lib/drb/extservm.rb (invoke_service_command): use Process.spawn. [ruby-dev:23103] * lib/rdoc/ri/ri_display.rb (setup_pager): use IO.popen. [ruby-dev:23086], [ruby-dev:23103] * lib/rdoc/diagram.rb (convert_to_png): ditto. * lib/rdoc/generators/chm_generator.rb (compile_project): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
95ce90a87e
Коммит
5aad820604
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
Tue Mar 2 16:30:21 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* io.c (pipe_open): erred program name should be reported by
|
||||
exceptions, instead of the first argument.
|
||||
|
||||
* process.c (rb_spawn): ditto.
|
||||
|
||||
* process.c (proc_spawn_v): use first argument as program name.
|
||||
|
||||
* win32/win32.c (rb_w32_aspawn): ditto.
|
||||
|
||||
* win32/win32.c (CreateChild): search executable file if no program
|
||||
name given.
|
||||
|
||||
* lib/drb/extservm.rb (invoke_service_command): use Process.spawn.
|
||||
[ruby-dev:23103]
|
||||
|
||||
* lib/rdoc/ri/ri_display.rb (setup_pager): use IO.popen.
|
||||
[ruby-dev:23086], [ruby-dev:23103]
|
||||
|
||||
* lib/rdoc/diagram.rb (convert_to_png): ditto.
|
||||
|
||||
* lib/rdoc/generators/chm_generator.rb (compile_project): ditto.
|
||||
|
||||
Tue Mar 2 12:24:03 2004 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/Makefile.sub, wince/Makefile.sub (config.h): shouldn't check
|
||||
|
|
13
io.c
13
io.c
|
@ -2608,12 +2608,15 @@ pipe_open(argc, argv, pname, mode)
|
|||
volatile int doexec;
|
||||
#elif defined(_WIN32)
|
||||
int openmode = rb_io_mode_modenum(mode);
|
||||
char *cmd = pname, *prog = NULL;
|
||||
char *prog = NULL;
|
||||
#endif
|
||||
char *cmd = pname;
|
||||
|
||||
if (!pname) {
|
||||
arg0 = rb_check_argv(argc, argv);
|
||||
if (arg0) pname = StringValuePtr(arg0);
|
||||
cmd = pname;
|
||||
if (!pname) pname = RSTRING(argv[0])->ptr;
|
||||
}
|
||||
|
||||
#if defined(HAVE_FORK)
|
||||
|
@ -2639,7 +2642,7 @@ pipe_open(argc, argv, pname, mode)
|
|||
if (doexec) {
|
||||
arg.exec.argc = argc;
|
||||
arg.exec.argv = argv;
|
||||
arg.exec.prog = pname;
|
||||
arg.exec.prog = cmd;
|
||||
pid = rb_fork(&status, popen_exec, &arg);
|
||||
}
|
||||
else {
|
||||
|
@ -2692,10 +2695,10 @@ pipe_open(argc, argv, pname, mode)
|
|||
#define PIPE_FDOPEN(i) (i?fpw:fpr)
|
||||
#else
|
||||
if (argc > 0) {
|
||||
prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
|
||||
pname = StringValuePtr(prog);
|
||||
arg0 = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
|
||||
cmd = StringValuePtr(arg0);
|
||||
}
|
||||
fpr = popen(pname, mode);
|
||||
fpr = popen(cmd, mode);
|
||||
|
||||
if (!fpr) rb_sys_fail(pname);
|
||||
#define PIPE_FDOPEN(i) (fpr)
|
||||
|
|
|
@ -84,11 +84,7 @@ module DRb
|
|||
return if @servers.include?(name)
|
||||
@servers[name] = false
|
||||
end
|
||||
if RUBY_PLATFORM =~ /mswin32/
|
||||
system("cmd /c start /b #{command} #{DRb.uri} #{name}")
|
||||
else
|
||||
system("#{command} #{DRb.uri} #{name} &")
|
||||
end
|
||||
Process.spawn("#{command} #{DRb.uri} #{name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -295,7 +295,7 @@ module RDoc
|
|||
f << graph.to_s << "\n"
|
||||
end
|
||||
|
||||
system "dot -T#{op_type} #{src} -o #{dot}"
|
||||
system "dot", "-T#{op_type}", src, "-o", dot
|
||||
|
||||
# Now construct the imagemap wrapper around
|
||||
# that png
|
||||
|
|
|
@ -4,7 +4,7 @@ module Generators
|
|||
|
||||
class CHMGenerator < HTMLGenerator
|
||||
|
||||
HHC_PATH = "c:\\Program Files\\HTML Help Workshop\\hhc.exe"
|
||||
HHC_PATH = "c:/Program Files/HTML Help Workshop/hhc.exe"
|
||||
|
||||
# Standard generator factory
|
||||
def CHMGenerator.for(options)
|
||||
|
@ -103,7 +103,7 @@ module Generators
|
|||
|
||||
# Invoke the windows help compiler to compiler the project
|
||||
def compile_project
|
||||
system("\"#{HHC_PATH}\" #@project_name")
|
||||
system(HHC_PATH, @project_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -196,10 +196,17 @@ class DefaultDisplay
|
|||
|
||||
def setup_pager
|
||||
unless @options.use_stdout
|
||||
require 'tempfile'
|
||||
|
||||
@save_stdout = STDOUT.clone
|
||||
STDOUT.reopen(Tempfile.new("ri_"))
|
||||
for pager in [ ENV['PAGER'], "less", "more", 'pager' ].compact.uniq
|
||||
begin
|
||||
pager = IO.popen(pager, "w")
|
||||
rescue
|
||||
else
|
||||
@save_stdout = STDOUT.clone
|
||||
STDOUT.reopen(pager)
|
||||
return
|
||||
end
|
||||
end
|
||||
@options.use_stdout = true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -207,20 +214,8 @@ class DefaultDisplay
|
|||
|
||||
def page_output
|
||||
unless @options.use_stdout
|
||||
path = STDOUT.path
|
||||
STDOUT.reopen(@save_stdout)
|
||||
@save_stdout = nil
|
||||
paged = false
|
||||
for pager in [ ENV['PAGER'], "less", "more <", 'pager' ].compact.uniq
|
||||
if system("#{pager} #{path}")
|
||||
paged = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if !paged
|
||||
@options.use_stdout = true
|
||||
puts File.read(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1066,6 +1066,7 @@ proc_spawn_v(argv, prog)
|
|||
{
|
||||
#if defined(_WIN32)
|
||||
char *cmd = ALLOCA_N(char, rb_w32_argv_size(argv));
|
||||
if (!prog) prog = argv[0];
|
||||
return rb_w32_spawn(P_NOWAIT, rb_w32_join_argv(cmd, argv), prog);
|
||||
#else
|
||||
char *extension;
|
||||
|
@ -1476,6 +1477,7 @@ rb_spawn(argc, argv)
|
|||
earg.argv = argv;
|
||||
earg.prog = prog ? RSTRING(prog)->ptr : 0;
|
||||
status = rb_fork(&status, (int (*)_((void*)))rb_exec, &earg);
|
||||
if (prog) argv[0] = prog;
|
||||
#elif defined HAVE_SPAWNV
|
||||
if (!argc) {
|
||||
status = proc_spawn(RSTRING(prog)->ptr);
|
||||
|
@ -1483,7 +1485,9 @@ rb_spawn(argc, argv)
|
|||
else {
|
||||
status = proc_spawn_n(argc, argv, prog);
|
||||
}
|
||||
if (prog) argv[0] = prog;
|
||||
#else
|
||||
if (prog) argv[0] = prog;
|
||||
prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
|
||||
status = system(StringValuePtr(prog));
|
||||
# if defined(__human68k__) || defined(__DJGPP__)
|
||||
|
|
|
@ -842,6 +842,7 @@ rb_w32_aspawn(int mode, const char *prog, char *const *argv)
|
|||
int len = rb_w32_argv_size(argv);
|
||||
char *cmd = ALLOCA_N(char, len);
|
||||
|
||||
if (!prog) prog = argv[0];
|
||||
return rb_w32_spawn(mode, rb_w32_join_argv(cmd, argv), prog);
|
||||
}
|
||||
|
||||
|
@ -855,6 +856,7 @@ CreateChild(const char *cmd, const char *prog, SECURITY_ATTRIBUTES *psa, HANDLE
|
|||
SECURITY_ATTRIBUTES sa;
|
||||
const char *shell;
|
||||
struct ChildRecord *child;
|
||||
char *p = NULL;
|
||||
|
||||
if (!cmd && !prog) {
|
||||
errno = EFAULT;
|
||||
|
@ -902,18 +904,9 @@ CreateChild(const char *cmd, const char *prog, SECURITY_ATTRIBUTES *psa, HANDLE
|
|||
dwCreationFlags = (NORMAL_PRIORITY_CLASS);
|
||||
|
||||
if (prog) {
|
||||
char *p = dln_find_exe(prog, NULL);
|
||||
if (!p) {
|
||||
if (!(p = dln_find_exe(prog, NULL))) {
|
||||
shell = prog;
|
||||
}
|
||||
else {
|
||||
shell = p;
|
||||
while (*p) {
|
||||
if ((unsigned char)*p == '/')
|
||||
*p = '\\';
|
||||
p = CharNext(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
int redir = -1;
|
||||
|
@ -933,6 +926,31 @@ CreateChild(const char *cmd, const char *prog, SECURITY_ATTRIBUTES *psa, HANDLE
|
|||
}
|
||||
else {
|
||||
shell = NULL;
|
||||
prog = cmd;
|
||||
for (;;) {
|
||||
if (!*prog) {
|
||||
p = dln_find_exe(cmd, NULL);
|
||||
break;
|
||||
}
|
||||
if (strchr(".:*?\"/\\", *prog)) break;
|
||||
if (ISSPACE(*prog) || strchr("<>|", *prog)) {
|
||||
int len = prog - cmd;
|
||||
p = ALLOCA_N(char, len + 1);
|
||||
memcpy(p, cmd, len);
|
||||
p[len] = 0;
|
||||
p = dln_find_exe(p, NULL);
|
||||
break;
|
||||
}
|
||||
prog++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (p) {
|
||||
shell = p;
|
||||
while (*p) {
|
||||
if ((unsigned char)*p == '/')
|
||||
*p = '\\';
|
||||
p = CharNext(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче