rbtrace 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 749067d1571441a26036b2113d552e9149367eeabc7eaf4af9ef351aae951796
4
- data.tar.gz: 8ae54a3fb1887572e1b029f30ea0d41410db199454d090ba017bd9e49ea61e3d
3
+ metadata.gz: ffdcce16c0cb92399ccb6684be8b23628703d420786b53ed035164d184e72488
4
+ data.tar.gz: 987b982955f4af23e247d4155a9ff134bdf2231e5443024a5357c7df14f581ef
5
5
  SHA512:
6
- metadata.gz: 8b1c9c04a8abecf3d6d77aef6c07f23eb7cfb0beef6e04fa9bf085f13da1b2426a660a2b374d7a7edea76972ef1746e90daaf43bff572669ba723780e74a1da3
7
- data.tar.gz: a8fff70aacfce0d0d3e51b7c5157d5aef248c159c94ae6f7c8b63e4ed3db96d676386470e2e807919004faf4cfc4dc731b533ae9c61e7c483d1c10225d609224
6
+ metadata.gz: 536787701408f0763ccf9345e6e4715cc2bf057e99f6be69d00ad431dc7685898267a2a76235d29875128711c87192d91e1b281dbe889579779321da66b3c1ca
7
+ data.tar.gz: 1fc1fd4f82e5ac0808e7f95f518a2f989902c7fe424a9a67f63632aca41e6a47a405a46a77022b618f32664b476a5b550e8e4d0aa1c27fe630e3916d82b27c84
@@ -10,7 +10,7 @@ jobs:
10
10
  fail-fast: false
11
11
  matrix:
12
12
  os: ["ubuntu-latest"]
13
- ruby: ["3.2", "3.1", "3.0", "2.7", "2.6"]
13
+ ruby: ["4.0", "3.4", "3.3", "3.2"]
14
14
  runs-on: ubuntu-latest
15
15
  steps:
16
16
  - name: Check out code
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ - 0.5.4 - 19-05-2026
2
+
3
+ - Fix --interactive irb mode not printing eval results
4
+
1
5
  - 0.5.3 - 03-12-2025
2
6
 
3
7
  - Fix --interactive irb mode
data/Rakefile CHANGED
@@ -1,14 +1,21 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+ CLEAN.include("ext/Makefile", "ext/*.o", "ext/*.so", "ext/*.bundle", "ext/mkmf.log")
4
+
3
5
  desc "Compile the c extension"
4
6
  task :compile do
5
7
  if File.exist?("ext/Makefile")
6
- system "(cd ext && make clean)"
8
+ sh "cd ext && make clean"
7
9
  end
8
- system "(cd ext && ruby extconf.rb)"
9
- system "(cd ext && make)"
10
+ sh "cd ext && ruby extconf.rb"
11
+ sh "cd ext && make"
10
12
  end
11
13
 
12
- task :build => :compile
14
+ desc "Run the integration test suite"
15
+ task :test do
16
+ sh "./test.sh"
17
+ end
13
18
 
19
+ task :default => :test
14
20
 
21
+ task :build => :compile
@@ -10,8 +10,12 @@ class IRB::Context
10
10
  RBTraceCLI.tracer.print(arg)
11
11
  end
12
12
 
13
+ # IRB renders a result by calling this and printing the +output+ buffer it
14
+ # hands in: since 1.15 it streams the inspected value into +output+ rather
15
+ # than using the return value. @last_value is the already-inspected String
16
+ # returned by the remote eval, so we write it straight into the buffer.
13
17
  def inspect_last_value(output = +"")
14
- @last_value
18
+ output << @last_value.to_s
15
19
  end
16
20
  end
17
21
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RBTracer
4
- VERSION = "0.5.3"
4
+ VERSION = "0.5.4"
5
5
  end
data/rbtrace.gemspec CHANGED
@@ -25,6 +25,9 @@ Gem::Specification.new do |s|
25
25
 
26
26
  s.add_development_dependency "rake"
27
27
 
28
+ # needed by test/interactive_irb_test.rb
29
+ s.add_development_dependency "irb", ">= 1.15"
30
+
28
31
  s.license = "MIT"
29
32
  s.summary = 'rbtrace: like strace but for ruby code'
30
33
  s.description = 'rbtrace shows you method calls happening inside another ruby process in real time.'
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # behavioral regression test for `rbtrace --interactive irb` (see PR #108).
4
+ #
5
+ # evaluating an expression should print its value back to the terminal; we had
6
+ # a bug that made it print nothing. The bug only surfaces on a TTY.
7
+ #
8
+ # usage: ruby test/interactive_irb_test.rb <pid-to-trace>
9
+
10
+ require "pty"
11
+ require "timeout"
12
+
13
+ pid = Integer(ARGV.fetch(0))
14
+ cmd = "bundle exec ./bin/rbtrace -p #{pid} --interactive irb"
15
+
16
+ output = +""
17
+ printed_result = false
18
+
19
+ begin
20
+ PTY.spawn({ "TERM" => "xterm" }, cmd) do |reader, writer, _child_pid|
21
+ Timeout.timeout(30) do
22
+ output << reader.readpartial(4096) until output.include?(">") # wait for prompt
23
+ writer.puts "1 + 1"
24
+ output << reader.readpartial(4096) until output.include?("=> 2")
25
+ printed_result = true
26
+ writer.puts "exit"
27
+ end
28
+ end
29
+ rescue Timeout::Error, Errno::EIO, EOFError
30
+ # printed_result stays false unless we saw "=> 2" above
31
+ end
32
+
33
+ if printed_result
34
+ puts "PASS: `--interactive irb` printed the eval result"
35
+ else
36
+ warn "FAIL: `--interactive irb` did not print `=> 2`"
37
+ warn output.gsub(/\e\[[0-9;?]*[A-Za-z]/, "")
38
+ exit 1
39
+ end
data/test.sh CHANGED
@@ -48,4 +48,9 @@ trace --gc -m Dir. --slow=250
48
48
  trace -m Process. Dir.pwd "Proc#call"
49
49
  trace --firehose
50
50
 
51
+ echo ------------------------------------------
52
+ echo interactive irb output
53
+ echo ------------------------------------------
54
+ bundle exec ruby test/interactive_irb_test.rb $PID
55
+
51
56
  cleanup
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbtrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aman Gupta
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: irb
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '1.15'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '1.15'
68
82
  description: rbtrace shows you method calls happening inside another ruby process
69
83
  in real time.
70
84
  email: aman@tmm1.net
@@ -98,6 +112,7 @@ files:
98
112
  - rbtrace.gemspec
99
113
  - server.rb
100
114
  - test.sh
115
+ - test/interactive_irb_test.rb
101
116
  - tracers/activerecord.tracer
102
117
  - tracers/eventmachine.tracer
103
118
  - tracers/io.tracer
@@ -124,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
139
  - !ruby/object:Gem::Version
125
140
  version: '0'
126
141
  requirements: []
127
- rubygems_version: 3.7.2
142
+ rubygems_version: 4.0.6
128
143
  specification_version: 4
129
144
  summary: 'rbtrace: like strace but for ruby code'
130
145
  test_files: []