summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-20 16:37:01 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-10-20 16:37:01 +0000
commit4098e5861e4a6dadf17e6502afbc139bcff3cd3b (patch)
tree46efc0ee553a8d4009758a4b18b4b52259923408 /lib
parent1b2d3f81ee00c3fc5f002aaf7a646ed08e605610 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/debug.rb29
-rw-r--r--lib/open3.rb24
2 files changed, 29 insertions, 24 deletions
diff --git a/lib/debug.rb b/lib/debug.rb
index 04e6c730c7..b6968cc338 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -456,14 +456,14 @@ class DEBUGGER__
end
when /^\s*p\s+/
- stdout.printf "%s\n", debug_eval($', binding)
+ stdout.printf "%s\n", debug_eval($', binding).inspect
when /^\s*h(?:elp)?$/
debug_print_help()
else
v = debug_eval(input, binding)
- stdout.printf "%s\n", v unless (v == nil)
+ stdout.printf "%s\n", v.inspect unless (v == nil)
end
end
end
@@ -474,7 +474,7 @@ class DEBUGGER__
Debugger help v.-0.002b
Commands
b[reak] [file|method:]<line|method>
- set breakpoint to some position
+ set breakpoint to some position
wat[ch] <expression> set watchpoint to some expression
cat[ch] <an Exception> set catchpoint to an exception
b[reak] list breakpoints
@@ -587,8 +587,7 @@ EOHELP
end
def check_break_points(file, pos, binding, id)
- return false if break_points.empty?
- MUTEX.lock
+ MUTEX.lock # Stop all threads before 'line' and 'call'.
file = File.basename(file)
n = 1
for b in break_points
@@ -610,24 +609,22 @@ EOHELP
end
def excn_handle(file, line, id, binding)
- stdout.printf "Exception `%s': %s\n", $!.type, $!
+ stdout.printf "%s:%d: `%s' (%s)\n", file, line, $!, $!.type
if $!.type <= SystemExit
set_trace_func nil
exit
end
- MUTEX.lock
- fs = @frames.size
- tb = caller(0)[-fs..-1]
- if tb
- for i in tb
- stdout.printf "\tfrom %s\n", i
- end
- end
if @catch and ($!.type.ancestors.find { |e| e.to_s == @catch })
+ MUTEX.lock
+ fs = @frames.size
+ tb = caller(0)[-fs..-1]
+ if tb
+ for i in tb
+ stdout.printf "\tfrom %s\n", i
+ end
+ end
debug_command(file, line, id, binding)
- else
- MUTEX.unlock
end
end
diff --git a/lib/open3.rb b/lib/open3.rb
index 27283f5019..11b9813bee 100644
--- a/lib/open3.rb
+++ b/lib/open3.rb
@@ -14,8 +14,8 @@ module Open3
pr = IO::pipe
pe = IO::pipe
- pid = fork
- if pid == nil then # child
+ pid = fork{
+ # child
pw[1].close
STDIN.reopen(pw[0])
pw[0].close
@@ -29,13 +29,21 @@ module Open3
pe[1].close
exec(cmd)
- exit
- else
- pw[0].close
- pr[1].close
- pe[1].close
- pi = [ pw[1], pr[0], pe[0] ]
+ _exit 127
+ }
+
+ pw[0].close
+ pr[1].close
+ pe[1].close
+ Thread.start do
+ sleep 1
+ Process.waitpid(pid)
+ end
+ pi = [ pw[1], pr[0], pe[0] ]
+ if defined? yield
+ return yield *pi
end
+ pi
end
module_function :popen3
end