The following scenarios produce the expected results:
from zsh, execute:
/usr/local/bin/pg_dump mydatabase #=> a bunch of sql outputfrom irb or rails console, execute:
`/usr/local/bin/pg_dump my_database` #=> a bunch of sql outputCall the same shell command from within a method:
class AppDb def contents `/usr/local/bin/pg_dump my_database` end end # from rails console: AppDb.new.contents #=> a bunch of sql stuff
However, when I test the very same AppDb class from Rspec, the shell command hangs indefinitely at the assertion:
expect(AppDb.new.contents).to match "PostgreSQL database dump complete"
Do you have any idea why this might be?
pwd, the result is properly captured and tested by rspec. The problem is that pg_dump is hanging (only in rspec context) and there's no diagnostic info available.