virt-manager/virtman-check-for-valid-display.patch

21 lines
810 B
Diff
Raw Normal View History

References: bnc#907958
Sanity check for those who forget '-X' on ssh and try to start virt-manager
Index: virt-manager-1.1.0/virt-manager
===================================================================
--- virt-manager-1.1.0.orig/virt-manager
+++ virt-manager-1.1.0/virt-manager
@@ -181,8 +181,11 @@ def main():
from gi.repository import Gtk
leftovers = sys.argv[1:]
- # This will error if Gtk wasn't correctly initialized
- Gtk.Window()
+ if os.environ.has_key('DISPLAY') and os.environ['DISPLAY']:
+ # This will error if Gtk wasn't correctly initialized
+ Gtk.Window()
+ else:
+ raise Exception("Error starting virt-manager: No graphical display found")
globals()["Gtk"] = Gtk
import virtManager.config