vendor/systemu.rb in pasv_lib-0.2.0 vs vendor/systemu.rb in pasv_lib-0.3.0

- old
+ new

@@ -23,11 +23,13 @@ # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -# This is a modified version of systemu by me (Ryan Moore). +# This is a (slightly) modified version of systemu by me (Ryan Moore). +# I've only changed which errors are raised and removed the systemu +# method from the Object class. require 'tmpdir' require 'socket' require 'fileutils' require 'rbconfig' @@ -43,20 +45,21 @@ end # # error class # +# This is now set up so any error intentially raised by systemu will inherit from SystemUniversal::Error. class Error < RuntimeError end - class Eexist < Error + class EEXIST < Error end # # constants # - SystemUniversal::VERSION = '2.6.5' unless SystemUniversal.send(:const_defined?, :VERSION) + SystemUniversal::VERSION = '2.6.5.9999' unless SystemUniversal.send(:const_defined?, :VERSION) def SystemUniversal.version() SystemUniversal::VERSION end def version() SystemUniversal::VERSION end def SystemUniversal.description "universal capture of stdout and stderr and handling of child process pid for windows, *nix, etc." end @@ -137,11 +140,11 @@ raise e else raise end - # regardless of the error raised, we want to raise SystemUniversal::Error so we have one thnig to catch. + # regardless of the error raised, we want to raise SystemUniversal::Error so we have one thnig to catch. rescue e raise Error, "systemu: Error - process interrupted (original error: #{e.inspect})!\n#{ buf }\n" rescue raise Error, "systemu: Error - process interrupted!\n#{ buf }\n" end @@ -291,10 +294,10 @@ tmp = File.join(d, slug_for("systemu_#{ @host }_#{ @ppid }_#{ @pid }_#{ rand }_#{ i += 1 }")) begin Dir.mkdir tmp rescue Errno::EEXIST => e - raise Eexist, e.message if i >= max + raise EEXIST, e.message if i >= max next end break( if b