Crash with gnome gui and Kernel.exec


I’m writing an interface for a command line utility. When I press a
start button, the callback calls Kernel.exec to make use of the command
line utility, passing to it the information collected from the UI. Well,
that’s what I wanted to do, cause what really happens is that the new
process (the command line utility) starts, but the GUI crashes, without
any message… Any ideas of why could be happening this crash? I’ve
tried also making a thread for the Kernel.exec part, but it crashes

Here is the method that doesn’t work:

def button2_clicked(widget)
nombre_destino = @entry1.text
pelicula = @filechooserbutton1.filename
subtitulos = @filechooserbutton2.filename
size = @spinbutton1.value
@thread = {
exec("mencoder -sub ‘#{subtitulos}’ -subfont-text-scale #{size}
" +
"’#{pelicula}’ -ovc lavc -lavcopts " +
"vcodec=mpeg4:vhq:vbitrate=1000 -oac mp3lame " +
“-lameopts br=256:vol=1 -ffourcc DIVX -o ‘#{nombre_destino}’”)
puts “error”

Thank you very much for your help.

euoar wrote:

exec("mencoder -sub ‘#{subtitulos}’ -subfont-text-scale #{size}

You’re using the wrong command for your plan.
Take a look at the rdoc
Exec replaces the current process, so thats why your gui exits.

Instead of exec, you should use system or IO.popen.

Joachim G. escribio’:

Instead of exec, you should use system or IO.popen.

Right, that fixed the problem. Thank you very much for your help,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs