Commit 30437471da4508adffe163c017febb8e6196f22e
- Date: Thu Oct 11 05:14:25 +0000 2007
- Committer: fbos (fbos@d6c2ea82-c31b-0410-8381-e9c44f9824c5)
- Author: fbos (fbos@d6c2ea82-c31b-0410-8381-e9c44f9824c5)
- Commit SHA1: 30437471da4508adffe163c017febb8e6196f22e
- Tree SHA1: 264fe075ceee3f8eb43cd8c8d7c0434e41da63db
Keep the SubversionClient clean by not including Open4 anymore. Attempt to load open4 even if rubygems is unavailable.
git-svn-id: svn+ssh://rubyforge.org/var/svn/piston/trunk@131 d6c2ea82-c31b-0410-8381-e9c44f9824c5
Commit diff
| |   |
| 32 | 32 | end |
| 33 | 33 | |
| 34 | 34 | begin |
| 35 | | raise LoadError, "Not implemented on Win32 machines" if RUBY_PLATFORM =~ /mswin32/ |
| 36 | | require "rubygems" |
| 35 | raise LoadError, "Not implemented on Win32 machines" if RUBY_PLATFORM =~ /mswin32/ |
| 36 | begin |
| 37 | require "rubygems" |
| 38 | rescue LoadError |
| 39 | # NOP -- attempt to load without Rubygems |
| 40 | end |
| 41 | |
| 37 | 42 | require "open4" |
| 38 | | include Open4 |
| 39 | 43 | |
| 40 | | def run_real(cmd) |
| 41 | | pid, stdin, stdout, stderr = popen4(cmd) |
| 44 | def run_real(cmd) |
| 45 | pid, stdin, stdout, stderr = Open4::popen4(cmd) |
| 42 | 46 | _, cmdstatus = Process.waitpid2(pid) |
| 43 | 47 | raise CommandError, "#{cmd.inspect} exited with status: #{cmdstatus.exitstatus}\n#{stderr.read}" unless cmdstatus.success? |
| 44 | 48 | return stdout.read |
| toggle raw diff |
--- a/lib/piston/subversion_client.rb
+++ b/lib/piston/subversion_client.rb
@@ -32,13 +32,17 @@ module Piston
end
begin
- raise LoadError, "Not implemented on Win32 machines" if RUBY_PLATFORM =~ /mswin32/
- require "rubygems"
+ raise LoadError, "Not implemented on Win32 machines" if RUBY_PLATFORM =~ /mswin32/
+ begin
+ require "rubygems"
+ rescue LoadError
+ # NOP -- attempt to load without Rubygems
+ end
+
require "open4"
- include Open4
- def run_real(cmd)
- pid, stdin, stdout, stderr = popen4(cmd)
+ def run_real(cmd)
+ pid, stdin, stdout, stderr = Open4::popen4(cmd)
_, cmdstatus = Process.waitpid2(pid)
raise CommandError, "#{cmd.inspect} exited with status: #{cmdstatus.exitstatus}\n#{stderr.read}" unless cmdstatus.success?
return stdout.read
|