You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by dj...@apache.org on 2009/06/23 02:00:28 UTC

svn commit: r787451 - /buildr/trunk/lib/buildr/core/util.rb

Author: djspiewak
Date: Tue Jun 23 00:00:28 2009
New Revision: 787451

URL: http://svn.apache.org/viewvc?rev=787451&view=rev
Log:
Added kludgy process status thingy

Modified:
    buildr/trunk/lib/buildr/core/util.rb

Modified: buildr/trunk/lib/buildr/core/util.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/util.rb?rev=787451&r1=787450&r2=787451&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/util.rb (original)
+++ buildr/trunk/lib/buildr/core/util.rb Tue Jun 23 00:00:28 2009
@@ -281,6 +281,60 @@
 
 if Buildr::Util.java_platform?
   require 'ffi'
+  
+  module Buildr
+    class ProcessStatus
+      attr_reader :pid, :termsig, :stopsig
+      
+      def initialize(pid, success)
+        @pid = pid
+        @success = success
+        
+        @termsig = nil
+        @stopsig = nil
+      end
+      
+      def &(num)
+        pid & num
+      end
+      
+      def ==(other)
+        pid == other.pid
+      end
+      
+      def >>(num)
+        pid >> num
+      end
+      
+      def coredump?
+        false
+      end
+      
+      def exited?
+        true
+      end
+      
+      def stopped?
+        false
+      end
+      
+      def success?
+        @success
+      end
+      
+      def to_i
+        pid
+      end
+      
+      def to_int
+        pid
+      end
+      
+      def to_s
+        pid.to_s
+      end
+    end
+  end
 
   module Kernel
     extend extend FFI::Library
@@ -290,7 +344,10 @@
     def system(cmd, *args)
       arg_str = args.map { |a| "'#{a}'" }
       cd = "cd '#{Dir.pwd}' && "
-      __native_system__(cd + cmd + ' ' + arg_str.join(' ')) == 0
+      back = __native_system__(cd + cmd + ' ' + arg_str.join(' ')) == 0
+      
+      $? = Buildr::ProcessStatus.new(0, back)    # KLUDGE
+      back
     end
   end
 end
\ No newline at end of file