rogerdpack-live_console 0.2.1

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.
Files changed (2) hide show
  1. data/bin/udscat +51 -0
  2. metadata +54 -0
data/bin/udscat ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This is a client for the unix domain socket version of LiveConsole. It just
4
+ # talks to the socket. It has been included so that you don't have to track
5
+ # down a version of netcat that does this.
6
+
7
+ require 'socket'
8
+
9
+ socket_path = ARGV.first
10
+ if socket_path.nil?
11
+ $stderr.puts "You must supply a path to the socket you want to connect to."
12
+ exit 1
13
+ end
14
+
15
+ client = UNIXSocket.new socket_path
16
+
17
+ $stdin.sync = $stdout.sync = client.sync = true
18
+
19
+ read_thread =
20
+ Thread.new {
21
+ loop {
22
+ begin
23
+ Thread.pass
24
+ $stdout.write client.read_nonblock(1024)
25
+ rescue Errno::EAGAIN, Errno::EINTR => e
26
+ IO.select [client], [], [], 1
27
+ rescue Errno::EOFError, Errno::EPIPE => e
28
+ # nothing
29
+ end
30
+ }
31
+ }
32
+
33
+ Thread.new {
34
+ loop {
35
+ begin
36
+ l = $stdin.read_nonblock(1024)
37
+ rescue Errno::EAGAIN
38
+ retry
39
+ end
40
+
41
+ begin
42
+ client.print l if IO.select [], [client], [], 1
43
+ rescue Errno::EPIPE => e
44
+ $stderr.puts "Other end closed."
45
+ exit 0
46
+ end
47
+ }
48
+ }
49
+
50
+ trap('INT') { exit 0 }
51
+ loop { sleep 1 }
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rogerdpack-live_console
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Pete Elmore
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-22 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A library to support adding a console to your running application.
17
+ email:
18
+ - pete.elmore@gmail.com
19
+ executables:
20
+ - udscat
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files: []
26
+
27
+ has_rdoc: false
28
+ homepage: http://debu.gs/live-console
29
+ post_install_message:
30
+ rdoc_options: []
31
+
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: "0"
39
+ version:
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ requirements: []
47
+
48
+ rubyforge_project: live-console
49
+ rubygems_version: 1.2.0
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: A library to support adding a console to your running application.
53
+ test_files: []
54
+