# Exec command stops thread

**URL:** <https://www.ruby-forum.com/t/exec-command-stops-thread/125482>\
**Category:** Ruby\
**Created:** [January 9, 2008, 3:17pm UTC](https://www.ruby-forum.com/t/exec-command-stops-thread/125482 "2008-01-09T15:17:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 9, 2008, 3:17pm UTC](https://www.ruby-forum.com/t/exec-command-stops-thread/125482/1 "2008-01-09T15:17:06Z")

</div>

hello  
i am trying to do the following  
exec(“copy e:\data\stocks\watchlists\_._ E:\data\MergedDb  
\watchlists\_._”)  
puts “copied”

My prog execution stops after exec is done. not sure why. how can i  
run a command and continue processing after the command.

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 9, 2008, 3:27pm UTC](https://www.ruby-forum.com/t/exec-command-stops-thread/125482/2 "2008-01-09T15:27:38Z")

</div>

On Jan 9, 2008 10:15 PM, Junkone [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> exec(“copy e:\data\stocks\watchlists\_._ E:\data\MergedDb  
> \watchlists\_._”)  
> puts “copied”
> 
> My prog execution stops after exec is done. not sure why. how can i  
> run a command and continue processing after the command.

when #exec executes, it will replace the (whole) current running  
program/process; thus you wont reach the “puts copied” portion…

try system or the backticks “`”

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [January 9, 2008, 3:28pm UTC](https://www.ruby-forum.com/t/exec-command-stops-thread/125482/3 "2008-01-09T15:28:49Z")

</div>

Junkone wrote:

> My prog execution stops after exec is done. not sure why.

Because that’s how exec works.

> how can i  
> run a command and continue processing after the command.

system

HTH,  
Sebastian
