[rspec-users] Inspect STDERR in a story
Ashley Moran
ashley.moran at patchspace.co.uk
Sat Apr 12 09:17:34 EDT 2008
On 12 Apr 2008, at 11:51, Edvard Majakari wrote:
> How about something along the lines
>
> cd project_dir do
> @stdout, @stdterr = capture_outputs("#{migrate} #{args}")
> end
>
> ...
> def capture_outputs(cmd)
> stderr_log = "/tmp" + "/#{$0}-{$$}.log"
> out = `cmd 2> #{stderr_log}`
> err = File.read(stderr_log) if File.exist? stderr_log
> [out, err]
> end
>
> Totally untested, but hopefully you get the idea?
Yeah! Don't know why I didn't think of just sending stderr to a log
file myself...
Thanks
Ashley
--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
More information about the rspec-users
mailing list