Browse files

quote command for paths with spaces in them - needs tested on windoze

  • Loading branch information...
1 parent 8fe8959 commit 613df510c492759a7fd390f98223dfe73b16a820 @ahoward ahoward committed Jun 24, 2010
Showing with 16 additions and 8 deletions.
  1. +4 −4 README
  2. +11 −3 lib/systemu.rb
  3. +1 −1 systemu.gemspec
View
8 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"
View
14 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 @@ def version() SystemUniversal::VERSION end
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 @@ def systemu
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 << status
end
end
+ def quote *args, &block
+ SystemUniversal.quote(*args, &block)
+ end
+
def new_thread cid, block
q = Queue.new
Thread.new(cid) do |cid|
View
2 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"

0 comments on commit 613df51

Please sign in to comment.