dbusutil

package
v0.0.0-...-1a99902 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SessionBus = func() (*dbus.Conn, error) {
	if isSessionBusLikelyPresent() {
		return dbus.SessionBus()
	}
	return nil, fmt.Errorf("cannot find session bus")
}

SessionBus is like dbus.SessionBus but it avoids auto-starting a new dbus-daemon when a bus is not already available.

The go-dbus package will launch a session bus instance on demand when none is present, something we do not want to do. In all contexts where there is a need

to use the session bus, we expect session bus daemon to have been started and

managed by the corresponding user session manager.

This function is mockable by either MockConnections or MockSessionBus.

View Source
var SystemBus = func() (*dbus.Conn, error) {
	return dbus.SystemBus()
}

SystemBus is like dbus.SystemBus and is provided for completeness.

This function is mockable by either MockConnections or MockSystemBus.

Functions

func MockConnections

func MockConnections(system, session func() (*dbus.Conn, error)) (restore func())

MockConnections mocks the connection functions system and session buses.

func MockOnlySessionBusAvailable

func MockOnlySessionBusAvailable(conn *dbus.Conn) (restore func())

MockOnlySessionBusAvailable makes SessionBus return the given connection.

In addition calling SystemBus will panic.

func MockOnlySystemBusAvailable

func MockOnlySystemBusAvailable(conn *dbus.Conn) (restore func())

MockOnlySystemBusAvailable makes SystemBus return the given connection.

In addition calling SessionBus will panic.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL