pageme 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +5 -1
  2. data/lib/pageme.rb +22 -7
  3. data/lib/pageme/version.rb +1 -1
  4. metadata +50 -26
data/README.md CHANGED
@@ -81,7 +81,11 @@ You can of course enable it again:
81
81
 
82
82
  ## Known bugs
83
83
 
84
- Closing the pager does not work correctly in some versions of JRuby due to a bug in the Unix domain socket implementation. I've yet to pin down exactly where it's fixed (it might not be fixed in any released versions. It works in head and doesn't work in 1.6.2), but you may see that page continues to block after the pager closes. This is due to JRuby not raising an error when writing to a broken socket and there's not much I can do about it. Sorry.
84
+ The JRuby support is a little flaky:
85
+
86
+ * Closing the pager does not work correctly in some versions of JRuby due to a bug in the Unix domain socket implementation. I've yet to pin down exactly where it's fixed (it might not be fixed in any released versions. It works in head and doesn't work in 1.6.2), but you may see that page continues to block after the pager closes. This is due to JRuby not raising an error when writing to a broken socket and there's not much I can do about it. Sorry.
87
+ * If the JVM has a melt down and dies without running the ensure block (e.g. because it gets SIGKILLed) your terminal can end up in a messed up state. Typing "stty echo" should fix this
88
+ * Similarly a JVM meltdown will sometimes leave the unix domain sockets used for communicating lying around
85
89
 
86
90
  ## Contributing
87
91
 
data/lib/pageme.rb CHANGED
@@ -72,23 +72,38 @@ module PageMe
72
72
  r.close
73
73
  end
74
74
 
75
- Kernel.trap("SIGINT"){ Process.kill "INT", child_pid }
75
+ previous_int_handler = Kernel.trap("SIGINT"){ Process.kill "INT", child_pid }
76
+ previous_term_handler = Kernel.trap("SIGTERM") do
77
+ Process.kill "TERM", child_pid
78
+ Process.wait child_pid, Process::WUNTRACED
79
+ child_pid = nil
80
+ if previous_term_handler == "DEFAULT"
81
+ raise SignalException.new("SIGTERM")
82
+ else
83
+ previous_term_handler.call
84
+ end
85
+ end
76
86
 
77
87
  begin
78
88
  page_to w, args
79
89
  rescue Errno::EPIPE
80
90
  rescue Exception => e
81
- unless w.closed?
82
- w.puts "#{e.class}: #{e.message}"
83
- e.backtrace.each{|l| w.puts "\t#{l}" }
84
- end
91
+ begin
92
+ unless w.closed?
93
+ w.puts "#{e.class}: #{e.message}"
94
+ e.backtrace.each{|l| w.puts "\t#{l}" }
95
+ end
96
+ rescue Errno::EPIPE
97
+ end
98
+
85
99
  raise
86
100
  ensure
87
101
  begin
88
102
  w.close unless w.closed?
89
103
  ensure
90
- Process.wait child_pid
91
- Kernel.trap("SIGINT", "DEFAULT")
104
+ Process.wait child_pid, Process::WUNTRACED if child_pid
105
+ Kernel.trap("SIGINT", previous_int_handler)
106
+ Kernel.trap("SIGTERM", previous_term_handler)
92
107
  File.delete(t) if t
93
108
  server.close if server
94
109
  end
@@ -1,3 +1,3 @@
1
1
  module Pageme
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,35 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pageme
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 25
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 3
10
+ version: 0.0.3
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - David R. MacIver
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-04-29 00:00:00.000000000 +01:00
17
+
18
+ date: 2012-05-01 00:00:00 +01:00
13
19
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
16
22
  name: posix-spawn
17
- requirement: &9034740 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
18
25
  none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 31
30
+ segments:
31
+ - 0
32
+ - 3
33
+ - 6
22
34
  version: 0.3.6
23
35
  type: :runtime
24
- prerelease: false
25
- version_requirements: *9034740
36
+ version_requirements: *id001
26
37
  description: Methods for invoking a pager
27
- email:
38
+ email:
28
39
  - david@drmaciver.com
29
40
  executables: []
41
+
30
42
  extensions: []
43
+
31
44
  extra_rdoc_files: []
32
- files:
45
+
46
+ files:
33
47
  - .gitignore
34
48
  - Gemfile
35
49
  - LICENSE
@@ -41,26 +55,36 @@ files:
41
55
  has_rdoc: true
42
56
  homepage: https://github.com/DRMacIver/pageme
43
57
  licenses: []
58
+
44
59
  post_install_message:
45
60
  rdoc_options: []
46
- require_paths:
61
+
62
+ require_paths:
47
63
  - lib
48
- required_ruby_version: !ruby/object:Gem::Requirement
64
+ required_ruby_version: !ruby/object:Gem::Requirement
49
65
  none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- required_rubygems_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
74
  none: false
56
- requirements:
57
- - - ! '>='
58
- - !ruby/object:Gem::Version
59
- version: '0'
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
60
82
  requirements: []
83
+
61
84
  rubyforge_project:
62
85
  rubygems_version: 1.6.2
63
86
  signing_key:
64
87
  specification_version: 3
65
88
  summary: Trivial gem for invoking a pager for your program data
66
89
  test_files: []
90
+