From 613df510c492759a7fd390f98223dfe73b16a820 Mon Sep 17 00:00:00 2001 From: "ara.t.howard" Date: Thu, 24 Jun 2010 07:49:32 -0600 Subject: quote command for paths with spaces in them - needs tested on windoze --- README | 8 ++++---- lib/systemu.rb | 14 +++++++++++--- systemu.gemspec | 2 +- 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 - [#, "Thu May 20 13:21:48 -0600 2010\n", "Thu May 20 13:21:48 -0600 2010\n"] + [#, "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 - [#, "Thu May 20 13:21:48 -0600 2010\n", "Thu May 20 13:21:48 -0600 2010\n"] + [#, "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 - # - "1274383308\n1274383309\n1274383310\n" + # + "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" -- cgit v1.2.1