Permalink
Browse files

handle forking, which previously led to the same random numbers (and …

…therefore tmpdirs) being generated
  • Loading branch information...
1 parent 6d7f758 commit 9d0d99872171eb9e310aeccf2349f9f6559fb760 @seamusabshere committed Mar 30, 2011
@@ -7,6 +7,7 @@ class RemoteTable
class Executor
include ::Singleton
def bang(path, cmd)
+ srand # in case this was forked by resque
tmp_path = "#{path}.bang.#{rand}"
backtick_with_reporting "cat #{::Escape.shell_single_word path} | #{cmd} > #{::Escape.shell_single_word tmp_path}"
::FileUtils.mv tmp_path, path
@@ -25,6 +25,7 @@ def definition
::Slither.send :definition, t.properties.schema_name
elsif t.properties.schema.is_a?(::Array)
everything = lambda { |_| true }
+ srand # in case this was forked by resque
::Slither.define(rand.to_s) do |d|
d.rows do |row|
row.trap(&everything)
@@ -212,6 +212,7 @@ def format
def staging_dir_path #:nodoc:
return @staging_dir_path if @staging_dir_path.is_a?(::String)
+ srand # in case this was forked by resque
@staging_dir_path = ::File.join ::Dir.tmpdir, 'remote_table_gem', rand.to_s
::FileUtils.mkdir_p @staging_dir_path
@staging_dir_path
@@ -1,3 +1,3 @@
class RemoteTable
- VERSION = "1.1.3"
+ VERSION = "1.1.4"
end

0 comments on commit 9d0d998

Please sign in to comment.