Skip to content

Commit

Permalink
Rescue getting DBus::SessionBus.instance when DISPLAY environment var…
Browse files Browse the repository at this point in the history
…iable is not set

Related: mvidner/ruby-dbus#53
  • Loading branch information
Josef Stribny committed Dec 14, 2015
1 parent d7676ac commit 45c05be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rubygems/nice_install/fedora_ext_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def install_using_packagekit(names=[])
pkg_kit = session_bus.introspect("org.freedesktop.PackageKit", "/org/freedesktop/PackageKit")
pkg_kit['org.freedesktop.PackageKit.Modify'].InstallPackageNames(0, names, 'show-confirm-install')
# DBus is not availabe in non-X environment.
rescue Errno::ENOENT
#
# Rescue NoMethodError when DISPLAY env variable is not set.
# See https://github.com/mvidner/ruby-dbus/issues/53
rescue NoMethodError, Errno::ENOENT
say "PackageKit failed. DBus activation failed."
false
rescue LoadError
Expand Down

0 comments on commit 45c05be

Please sign in to comment.