# RubySpec: Exceptions in before/after get lost in output

**URL:** <https://www.ruby-forum.com/t/rubyspec-exceptions-in-before-after-get-lost-in-output/160102>\
**Category:** IronRuby\
**Created:** [February 11, 2009, 8:42pm UTC](https://www.ruby-forum.com/t/rubyspec-exceptions-in-before-after-get-lost-in-output/160102 "2009-02-11T20:42:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [February 11, 2009, 8:42pm UTC](https://www.ruby-forum.com/t/rubyspec-exceptions-in-before-after-get-lost-in-output/160102/1 "2009-02-11T20:42:47Z")

</div>

core/io/close\_read\_spec.rb does not work on my machine because it has  
the following code, but I don’t have “cat” on my machine.

describe “IO#close\_read” do

before :each do  
@io = IO.popen ‘cat’, “r+”  
@path = tmp(‘io.close.txt’)  
end

However, running it does not report any errors in the final summary.  
There is output indicating that something went bad, but if you run all  
the tests together, the output scrolls past, and you won’t realize it.

c:\vsl\Merlin\External\Languages\IronRuby\mspec\>c:\vsl\Merlin\Main\test\scripts\ir.cmd  
mspec\bin\mspec-run -fd --verbose --excl-tag fails --excl-tag critical  
–config default.mspec rubyspec/core/io/close\_read\_spec.rb

rubyspec/core/io/close\_read\_spec.rb’cat’ is not recognized as an  
internal or external command,  
operable program or batch file.  
.‘cat’ is not recognized as an internal or external command,  
operable program or batch file.  
.

Finished in 1.738000 seconds

1 file, 2 examples, 2 expectations, 0 failures, 0 errors

Shouldn’t mspec report this as an error?

Thanks,  
Shri

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [February 12, 2009, 9:45am UTC](https://www.ruby-forum.com/t/rubyspec-exceptions-in-before-after-get-lost-in-output/160102/2 "2009-02-12T09:45:03Z")

</div>

Shri B. wrote:

> core/io/close\_read\_spec.rb does not work on my machine because it has  
> the following code, but I donâ€™t have â€œcatâ€ on my machine.  
> …  
> However, running it does not report any errors in the final summary.  
> There is output indicating that something went bad, but if you run all  
> the tests together, the output scrolls past, and you wonâ€™t realize it.  
> …  
> .‘cat’ is not recognized as an internal or external command,  
> …  
> Shouldnâ€™t mspec report this as an error?

Probably should. The problem is that popen always returns the IO streams  
for the subprocess, which may be cmd reporting the ‘cat’ error. I  
suppose it could be modified to one of the other popen variants that set  
process exit status. You should bring it up on rubyspec ML or on IRC.

- Charlie

---

<div class="post-metadata">

**Author:** ![Shri\_B](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@Shri\_B](https://www.ruby-forum.com/u/Shri_B)\
**Post date:** [February 17, 2009, 1:19am UTC](https://www.ruby-forum.com/t/rubyspec-exceptions-in-before-after-get-lost-in-output/160102/3 "2009-02-17T01:19:38Z")

</div>

There’s also a dependency on “yes” in the popen specs. However, you can  
get “cat” if you install the gnutools for windows, but that definitely  
shouldn’t be a requirement on the specs. Especially since “yes” isn’t  
included in the gnutools. In both cases you can probably just depend on  
the current ruby install to do replicate the behavior of those commands.  
Anyway, Jim, can you submit a patch to RubySpec that removes these  
dependencies?

~js
