Skip to content

Commit b514956

Browse files
committed
use system instead of `` to run dumps (on < 4.0) as it has issues under 1.7.x
due jruby/jruby#3459
1 parent 1cde111 commit b514956

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/arjdbc/tasks/databases3.rake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,12 @@ namespace :db do
100100
unless search_path.blank?
101101
search_path = search_path.split(",").map{ |part| "--schema=#{Shellwords.escape(part.strip)}" }.join(" ")
102102
end
103-
`pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['database'])}`
104-
raise 'Error dumping database' if $?.exitstatus == 1
103+
sh "pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(config['database'])}"
105104

106105
File.open(filename, 'a') { |f| f << "SET search_path TO #{ActiveRecord::Base.connection.schema_search_path};\n\n" }
107106
when /sqlite/
108107
dbfile = config['database']
109-
`sqlite3 #{dbfile} .schema > #{filename}`
108+
sh "sqlite3 #{dbfile} .schema > #{filename}"
110109
else
111110
ActiveRecord::Base.establish_connection(config)
112111
ArJdbc::Tasks.structure_dump(config, filename)
@@ -115,10 +114,11 @@ namespace :db do
115114
if ActiveRecord::Base.connection.supports_migrations?
116115
File.open(filename, 'a') { |f| f << ActiveRecord::Base.connection.dump_schema_information }
117116
end
117+
118118
end
119119

120120
redefine_task :load do
121-
config = current_config
121+
config = current_config
122122
filename = structure_sql
123123

124124
case config['adapter']

0 commit comments

Comments
 (0)