summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorara.t.howard <ara.t.howard@gmail.com>2010-06-24 07:49:32 -0600
committerara.t.howard <ara.t.howard@gmail.com>2010-06-24 07:49:32 -0600
commit613df510c492759a7fd390f98223dfe73b16a820 (patch)
treeeb287e61c01859d999f10cf8d4384c17483c60f3
parent8fe89594c7ad3173178e89b57a0b1c087f823ef1 (diff)
downloadsystemu-613df510c492759a7fd390f98223dfe73b16a820.tar.gz
quote command for paths with spaces in them - needs tested on windoze
-rw-r--r--README8
-rw-r--r--lib/systemu.rb14
-rw-r--r--systemu.gemspec2
3 files changed, 16 insertions, 8 deletions
diff --git a/README b/README
index aa185e8..0070335 100644
--- a/README
+++ b/README
@@ -53,7 +53,7 @@ SAMPLES
~ > ruby samples/a.rb
- [#<Process::Status: pid=3359,exited(0)>, "Thu May 20 13:21:48 -0600 2010\n", "Thu May 20 13:21:48 -0600 2010\n"]
+ [#<Process::Status: pid=95599,exited(0)>, "Thu Jun 24 07:47:38 -0600 2010\n", "Thu Jun 24 07:47:38 -0600 2010\n"]
<========< samples/b.rb >========>
@@ -75,7 +75,7 @@ SAMPLES
~ > ruby samples/b.rb
- [#<Process::Status: pid=3364,exited(0)>, "Thu May 20 13:21:48 -0600 2010\n", "Thu May 20 13:21:48 -0600 2010\n"]
+ [#<Process::Status: pid=95604,exited(0)>, "Thu Jun 24 07:47:38 -0600 2010\n", "Thu Jun 24 07:47:38 -0600 2010\n"]
<========< samples/c.rb >========>
@@ -163,7 +163,7 @@ SAMPLES
~ > ruby samples/f.rb
- #<Process::Status: pid=3384,signaled(SIGKILL=9)>
- "1274383308\n1274383309\n1274383310\n"
+ #<Process::Status: pid=95624,signaled(SIGKILL=9)>
+ "1277387258\n1277387259\n1277387260\n"
diff --git a/lib/systemu.rb b/lib/systemu.rb
index 71348bb..9e44d9e 100644
--- a/lib/systemu.rb
+++ b/lib/systemu.rb
@@ -14,7 +14,7 @@ class SystemUniversal
#
# constants
#
- SystemUniversal::VERSION = '2.0.0' unless SystemUniversal.send(:const_defined?, :VERSION)
+ SystemUniversal::VERSION = '2.1.0' unless SystemUniversal.send(:const_defined?, :VERSION)
def SystemUniversal.version() SystemUniversal::VERSION end
def version() SystemUniversal::VERSION end
#
@@ -34,8 +34,12 @@ class SystemUniversal
system('%s -e 42' % 'ruby') ? 'ruby' : warn('no ruby in PATH/CONFIG')
end
- class << self
+ class << SystemUniversal
%w( host ppid pid ruby turd ).each{|a| attr_accessor a}
+
+ def quote(*words)
+ words.map{|word| word.inspect}.join(' ')
+ end
end
#
@@ -69,7 +73,7 @@ class SystemUniversal
thread = nil
quietly{
- IO.popen "#{ @ruby } #{ c['program'] }", 'r+' do |pipe|
+ IO.popen "#{ quote(@ruby) } #{ quote(c['program']) }", 'r+' do |pipe|
line = pipe.gets
case line
when %r/^pid: \d+$/
@@ -113,6 +117,10 @@ class SystemUniversal
end
end
+ def quote *args, &block
+ SystemUniversal.quote(*args, &block)
+ end
+
def new_thread cid, block
q = Queue.new
Thread.new(cid) do |cid|
diff --git a/systemu.gemspec b/systemu.gemspec
index bc8841b..2e46c0c 100644
--- a/systemu.gemspec
+++ b/systemu.gemspec
@@ -3,7 +3,7 @@
Gem::Specification::new do |spec|
spec.name = "systemu"
- spec.version = "1.8.6"
+ spec.version = "2.0.0"
spec.platform = Gem::Platform::RUBY
spec.summary = "systemu"
spec.description = "description: systemu kicks the ass"