chukan 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/chukan.rb +14 -2
  2. metadata +2 -2
@@ -120,7 +120,9 @@ module Chukan
120
120
  def initialize(*cmdline)
121
121
  @cmdline = cmdline.map {|x| x.to_s }
122
122
  @status = nil
123
- @shortname = File.basename(cmdline.first.split(/\s/,2).first)[0, 12]
123
+ @shortname = cmdline.join(' ').split(/\s/)
124
+ @shortname[0] = File.basename(@shortname[0])
125
+ @shortname = @shortname.join(' ')[0, 12]
124
126
  start
125
127
  end
126
128
 
@@ -128,7 +130,6 @@ module Chukan
128
130
  attr_reader :stdin, :stdout, :stderr
129
131
  attr_reader :pid
130
132
  attr_reader :status
131
- attr_reader :msg_prefix
132
133
 
133
134
  def join
134
135
  @status = Process.waitpid2(@pid)[1]
@@ -168,6 +169,17 @@ module Chukan
168
169
  signal(:SIGHUP)
169
170
  end
170
171
 
172
+ def set_display(shortname)
173
+ if shortname.length <= 12
174
+ @msg_prefix[0..-1] = "[%-12s %6d] " % [shortname, @pid]
175
+ elsif shortname.length < 19
176
+ @msg_prefix[0..-1] = "[%-19s] " % [shortname]
177
+ else
178
+ @msg_prefix[0..-1] = "[#{shortname}] "
179
+ end
180
+ self
181
+ end
182
+
171
183
  private
172
184
  def io_join(io, pattern, &block)
173
185
  if pattern.is_a?(String)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chukan
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - FURUHASHI Sadayuki
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-25 00:00:00 +09:00
12
+ date: 2009-11-26 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15