Skip to content

Instantly share code, notes, and snippets.

@liluo
Forked from jarmo/all-out.txt
Created April 1, 2017 07:42
Show Gist options
  • Select an option

  • Save liluo/1f443c9c33f43dacdecf86828e54b4e0 to your computer and use it in GitHub Desktop.

Select an option

Save liluo/1f443c9c33f43dacdecf86828e54b4e0 to your computer and use it in GitHub Desktop.

Revisions

  1. @jarmo jarmo revised this gist Nov 8, 2012. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion combined.rb
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    trap 'INT' do
    if RUBY_VERSION =~ /^1.8/
    if RUBY_VERSION =~ /^1\.8\./
    STDERR.puts "Current thread: #{Thread.inspect}"
    STDERR.puts caller.join("\n \\_ ")
    else
    2 changes: 1 addition & 1 deletion exiting.rb
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    trap 'INT' do
    exit Signal.list["INT"] if interrupted
    interrupted = true
    if RUBY_VERSION =~ /^1.8/
    if RUBY_VERSION =~ /^1\.8\./
    STDERR.puts "Current thread: #{Thread.inspect}"
    STDERR.puts caller.join("\n \\_ ")
    else
  2. @jarmo jarmo revised this gist Jul 14, 2012. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions exiting.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    interrupted = false
    trap 'INT' do
    exit Signal.list["INT"] if interrupted
    interrupted = true
    if RUBY_VERSION =~ /^1.8/
    STDERR.puts "Current thread: #{Thread.inspect}"
    STDERR.puts caller.join("\n \\_ ")
    else
    Thread.list.each do |thread|
    STDERR.puts "Thread-#{thread.object_id.to_s(36)}"
    STDERR.puts thread.backtrace.join("\n \\_ ")
    end
    end
    puts "Press Ctrl+C again to exit..."
    sleep 1
    interrupted = false
    end
  3. @jarmo jarmo revised this gist Jul 14, 2012. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions combined.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    trap 'INT' do
    if RUBY_VERSION =~ /^1.8/
    STDERR.puts "Current thread: #{Thread.inspect}"
    STDERR.puts caller.join("\n \\_ ")
    else
    Thread.list.each do |thread|
    STDERR.puts "Thread-#{thread.object_id.to_s(36)}"
    STDERR.puts thread.backtrace.join("\n \\_ ")
    end
    end
    end
  4. @jarmo jarmo revised this gist Jul 14, 2012. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions curr-thread.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    trap 'INT' do
    STDERR.puts "Current thread: #{Thread.inspect}"
    STDERR.puts caller.join("\n \\_ ")
    end
  5. @jarmo jarmo revised this gist Jul 14, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions all-threads.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    trap 'INT' do
    Thread.list.each do |thread|
    puts "Thread-#{thread.object_id.to_s(36)}"
    puts thread.backtrace.join("\n \\_ ")
    STDERR.puts "Thread-#{thread.object_id.to_s(36)}"
    STDERR.puts thread.backtrace.join("\n \\_ ")
    end
    end
  6. @jarmo jarmo revised this gist Jul 14, 2012. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions all-out.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    Thread-9jnxc
    looping.rb:17:in `block (2 levels) in <main>'
    \_ looping.rb:15:in `each'
    \_ looping.rb:15:in `block in <main>'
    \_ looping.rb:22:in `call'
    \_ looping.rb:22:in `condition'
    \_ looping.rb:26:in `looping'
    \_ looping.rb:31:in `<main>'
  7. @jarmo jarmo revised this gist Jul 14, 2012. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions all-threads.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    trap 'INT' do
    Thread.list.each do |thread|
    puts "Thread-#{thread.object_id.to_s(36)}"
    puts thread.backtrace.join("\n \\_ ")
    end
    end
  8. @jarmo jarmo created this gist Jul 14, 2012.
    11 changes: 11 additions & 0 deletions looping.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    def condition
    true
    end

    def looping
    while condition
    # do something
    end
    end

    looping