Spawning processes from Ruby/TK

(Mehr, Assaph (Assaph)) #1

One more note: it’s on windows, so:
exec("#{cmd % [file]}") if fork == nil
Doesn’t work. I get a message box saying: ‘fork’ Resource temporarily
unavailable - fork(2).



-----Original Message-----
From: Mehr, Assaph (Assaph)
Sent: Tuesday, 10 February 2004 13:22 PM
To: ruby-talk ML
Subject: spawning processes from Ruby/TK


I need to launch an external process from a Tk app. I have a list-box of
file names that should be processes as follows:

listbox.bind('Double-Button-1') {
    file = listbox.get(listbox.curselection)
    errors += `#{cmd % [file]}`

This causes a repeated error message:

C:\bin\cygwin\bin\ruby.exe: *** unable to remap
C:\bin\cygwin\bin\tk84.dll to same address as parent(0x8C40000) !=
0x8C50000 4274332 [main] ruby 2584 sync_with_child: child 3260(0x280)
died before initialization with status code 0x1 4274659 [main] ruby 2584
sync_with_child: *** child state child loading dlls

So do ‘system’ and ‘IO.popen’ calls. ‘exec’ works, but of course
terminates the app. Any ideas what’s wrong?