ankane/pgsync · error · Error

Command exited with non-zero status: #{command}

Error message

Command exited with non-zero status:
#{command}

What it means

Error "Command exited with non-zero status: #{command}" thrown in ankane/pgsync.

Source

Thrown at lib/pgsync/sync.rb:159

    def destination
      @destination ||= data_source(@options[:to], "to")
    end

    def data_source(url, name)
      ds = DataSource.new(url, name: name, debug: @options[:debug])
      ObjectSpace.define_finalizer(self, self.class.finalize(ds))
      ds
    end

    # ideally aliases would work, but haven't found a nice way to do this
    def resolve_source(source)
      if source
        source = source.dup
        source.gsub!(/\$\([^)]+\)/) do |m|
          command = m[2..-2]
          result = `#{command}`.chomp
          unless $?.success?
            raise Error, "Command exited with non-zero status:\n#{command}"
          end
          result
        end
      end
      source
    end

    def self.finalize(ds)
      # must use proc instead of stabby lambda
      proc { ds.close }
    end
  end
end

View on GitHub (pinned to 57bdddf5db)

When it happens

Trigger: Thrown at lib/pgsync/sync.rb:159 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ankane/pgsync@57bdddf5db (2026-08-23). Data as JSON: /api/errors/aeda396212a4a3d2. Report an issue: GitHub.