# Problem in exiting from a file and continue with next file

**URL:** <https://www.ruby-forum.com/t/problem-in-exiting-from-a-file-and-continue-with-next-file/134390>\
**Category:** Ruby\
**Created:** [April 10, 2008, 1:44pm UTC](https://www.ruby-forum.com/t/problem-in-exiting-from-a-file-and-continue-with-next-file/134390 "2008-04-10T13:44:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 10, 2008, 1:44pm UTC](https://www.ruby-forum.com/t/problem-in-exiting-from-a-file-and-continue-with-next-file/134390/1 "2008-04-10T13:44:18Z")

</div>

Hi,

I am writing automated test scripts using ruby. I have written two  
files.

test\_one.rb  
test\_two.rb

I have written some methods both the files. When one of the methods of  
test\_one.rb is running, If a condition fails, the control should exit  
from test\_one.rb and should continue with test\_two.rb.

I tried with “exit” method. But it exits from the whole(i.e -  
test\_two.rb is not executed). I want to exit from the test\_one.rb and  
continue with test\_two.rb.

Any of your suggestion is appreciated.

Thanks in advance…

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 10, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/problem-in-exiting-from-a-file-and-continue-with-next-file/134390/2 "2008-04-10T15:19:03Z")

</div>

Karthi kn wrote:

> Hi,
> 
> I am writing automated test scripts using ruby. I have written two  
> files.
> 
> test\_one.rb  
> test\_two.rb
> 
> I have written some methods both the files. When one of the methods of  
> test\_one.rb is running, If a condition fails, the control should exit  
> from test\_one.rb and should continue with test\_two.rb.
> 
> I tried with “exit” method. But it exits from the whole(i.e -  
> test\_two.rb is not executed). I want to exit from the test\_one.rb and  
> continue with test\_two.rb.
> 
> Any of your suggestion is appreciated.
> 
> Thanks in advance…

If you are on windows:

system ‘system start test\_two.rb’  
exit

regards,

Siep

---

<div class="post-metadata">

**Author:** ![karthikeyan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/898d66/32.png) [@karthikeyan](https://www.ruby-forum.com/u/karthikeyan)\
**Post date:** [April 10, 2008, 3:47pm UTC](https://www.ruby-forum.com/t/problem-in-exiting-from-a-file-and-continue-with-next-file/134390/3 "2008-04-10T15:47:17Z")

</div>

Karthi kn ha scritto:

> from test\_one.rb and should continue with test\_two.rb.
> 
> I tried with “exit” method. But it exits from the whole(i.e -  
> test\_two.rb is not executed). I want to exit from the test\_one.rb and  
> continue with test\_two.rb.
> 
> Any of your suggestion is appreciated.
> 
> Thanks in advance…

I’m in a rush, so I am not able to check my suggestion. Using “try/  
catch”?  
(see at the end of  
[http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut\_exceptions.html](http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_exceptions.html))
