From: Jano Svitok Date: 2008-03-04T20:29:02+09:00 Subject: Re: problems closing a CD On Tue, Mar 4, 2008 at 11:58 AM, Tom Cloyd wrote: > I'm utterly baffled by this simple problem in a ruby program I've run a > number of time on Windows. I'm now running Kubuntu Linux, and things > work differently (!). > > This program reads a series of data CDs, cataloging their contents. To > stop the process, I input a zero length volume label (well, on Windows I > do, anyway; on Linux this errors off, but that's not my current problem). > > What I can't do is get the CD just read in to be released by the program > so I can read in the next one. > > Code: > > > archive_source_dir = '/cdrom' # this is where the CD appears when I > put it in the drive > > Processing begins when the program has the volume label of the CD (this > is used as the key in a hash containing an array of the tree paths). > When it has traversed the directory tree on the CD, it asks for the next > volume label. In Windows, I just punch the open button on the drive, > replaced the CD with a new one, close the drive, keyed in the new volume > label, and kept going. Linux won't release the CD. > > I've tried many things to get the CD to go release, including... > > archive_source_dir.close > > IO.close(archive_source_dir) > > File.close(archive_source_dir) > > I get "undefined method" errors on everything. I have no idea why. Isn't > everything a file in linux? Guess not. > > Plainly I'm missing some simple concept here, but I can't see it. > > Would appreciate any help. > > Tom I guess this has something to do with mounting/umounting, though I don't know too much about automatic mounting in kubuntu. Try using `umount /cdrom` after you are done. (Don't forget to close any open files and move away from that dir). You might encounter some privileges problems ("only root can do") - try sudo in that case, or modify /etc/fstab to allow users to mount/umount. `eject` and `eject -t` might be useful as well.