diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-09-06 22:57:41 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-09-06 22:57:41 +0000 |
commit | 375772bc4fb32d5cc957268de65eea01620a335a (patch) | |
tree | c84725808837cd46413b016905f0d6910ec0ae77 /test/helper.rb | |
parent | f2915737c61854e69b57e388f4dbc36f1aee118d (diff) | |
download | dtas-375772bc4fb32d5cc957268de65eea01620a335a.tar.gz |
at_exit ordering is funky because minitest/autorun also runs at_exit, so we need to delay registering the at_exit until we call tmpfifo.
Diffstat (limited to 'test/helper.rb')
-rw-r--r-- | test/helper.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/helper.rb b/test/helper.rb index a36332b..81bc22f 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -50,12 +50,17 @@ Testcase = Minitest.const_defined?(:Test) ? Minitest::Test : Minitest::Unit::TestCase FIFOS = [] -at_exit { FIFOS.each { |(pid,path)| File.unlink(path) if $$ == pid } } def tmpfifo tmp = Tempfile.new(%w(dtas-test .fifo)) path = tmp.path tmp.close! assert system(*%W(mkfifo #{path})), "mkfifo #{path}" + + if FIFOS.empty? + at_exit do + FIFOS.each { |(pid,path)| File.unlink(path) if $$ == pid } + end + end FIFOS << [ $$, path ] path end |