Should rake remove t.name on failed tasks?

J

Josef Wolf

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?
 
D

Daniel Berger

Josef said:
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?

That seems a reasonable request. Jim, is there any downside to this?

Regards,

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top