# Should rake remove t.name on failed tasks?

**URL:** <https://www.ruby-forum.com/t/should-rake-remove-t-name-on-failed-tasks/77669>\
**Category:** Ruby\
**Created:** [November 29, 2006, 4:43pm UTC](https://www.ruby-forum.com/t/should-rake-remove-t-name-on-failed-tasks/77669 "2006-11-29T16:43:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josef\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@Josef\_W](https://www.ruby-forum.com/u/Josef_W)\
**Post date:** [November 29, 2006, 4:43pm UTC](https://www.ruby-forum.com/t/should-rake-remove-t-name-on-failed-tasks/77669/1 "2006-11-29T16:43:40Z")

</div>

Hello!

With rake, I often find myself doing something like that:

file “custom.iso” =\> “custom.dir” do |t|  
begin  
sh “mkisofs -r -V My Install CD’ -cache-inodes” +  
" -J -l -b isolinux/isolinux.bin" +  
" -c isolinux/boot.cat -no-emul-boot" +  
" -boot-load-size 4 -boot-info-table" +  
" -o #{t.name} #{custom.dir}"

```
rescue
  sh "rm #{t.name}"
  raise

end

```

end

to avoid a broken target lying around.

I wonder whether I am missing something here. Shouldn’t rake remove  
t.name?  
I mean, once rake has started to build a target, it is pretty much sure  
that  
the target _have_ to be rebuilt. Thus there’s no rason to let a  
half-baked  
target lying around should the build of that target fail.

AFAICS, make removes the target if it fails to build it, too.

What am I missing here? Any suggestions?

---

<div class="post-metadata">

**Author:** ![Josef\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/c0e974/32.png) [@Josef\_W](https://www.ruby-forum.com/u/Josef_W)\
**Post date:** [November 29, 2006, 4:55pm UTC](https://www.ruby-forum.com/t/should-rake-remove-t-name-on-failed-tasks/77669/2 "2006-11-29T16:55:42Z")

</div>

Josef W. wrote:

> ```
> " -o #{t.name} #{custom.dir}"
> 
> ```
> 
> I wonder whether I am missing something here. Shouldn’t rake remove t.name?  
> That seems a reasonable request. Jim, is there any downside to this?

Regards,

Dan
