Hi again,

I have defined several chrooted environments on my computer.
I'd like to issue the same command(s) in each of them. In a shell
I can do it with a for loop (example chrooting 2 successives times to
the same chroot)

for f in "/mnt/test-chroot/"  "/mnt/test-chroot/"; do chroot $f ls -a 
/mnt; done

I wondered if I could do it in Ruby using Dir.chroot.
The problem is that this changes the root for the running script,
and getting out of it is not possible (I suppose).
Having just read that continuations saved the whole context when it is
created, I thought to use it, but it doesn't work (script below chroots
correctly the first time, but not the second).

Is what I am trying to do possible?

Thanks.

Raph


#!/usr/bin/ruby1.8
["/mnt/test-chroot","/mnt/test-chroot"].each do |dir|
	callcc{|cc|
		p "will chroot to "+dir
		Dir.chroot(dir)
		
		p "will list files in /mnt for chroot " + dir
		Dir.foreach("/mnt") {|f| p f}
		
		p "*"*80
		cc.call
	}
end