http://bugzilla.suse.com/show_bug.cgi?id=943757
http://bugzilla.suse.com/show_bug.cgi?id=943757#c6
Ancor Gonzalez Sosa changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ancor@suse.com
--- Comment #6 from Ancor Gonzalez Sosa ---
Talking about ruby-based solutions, this works. But it's more an experiment
than a reliable fix. I would rather try to replace $stderr by a proper IO
object, instead of hijacking #puts and #print (since there are also #printf,
#putc, #write...)
require "yast"
include Yast::UIShortcuts
$stderr.puts "Hello, stderr! 1"
$stderr.define_singleton_method(:puts) do |*args|
if args.empty?
Yast.y2error($/)
else
Yast.y2error(args.join($/))
end
end
$stderr.define_singleton_method(:print) do |*args|
if args.empty?
Yast.y2error($_)
else
Yast.y2error(args.map(&:to_s).join($,) + $\.to_s)
end
end
module Yast
import "UI"
UI.OpenDialog(PushButton("Hello, World!"))
# Al this messages works as expected (logging to YaST logs)
$stderr.puts "Hello, stderr! 2"
$stderr.puts "Halo", "stderr!", "2"
$stderr.print "Hola, ! 2"
$stderr.print "Ahoj", "stderr!", "2"
UI.UserInput
UI.CloseDialog
end
--
You are receiving this mail because:
You are on the CC list for the bug.