raunch

Crates.ioraunch
lib.rsraunch
version1.0.1
sourcesrc
created_at2020-05-07 21:26:04.948693
updated_at2024-04-15 12:16:01.475041
descriptionA safe wrapper around launchd launch_activate_socket
homepage
repositoryhttps://github.com/bbqsrc/raunch
max_upload_size
id238710
size5,669
Brendan Molloy (bbqsrc)

documentation

README

Raunch

A safe wrapper around launchd launch_activate_socket.

#[cfg(target_os = "macos")]
let descriptors = raunch::activate_socket("socket-name").expect("activation to work");

The name of the socket (here socket-name) needs to match the socket name in the plist file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.example.agent</string>
	<key>OnDemand</key>
	<true/>
	<key>ProgramArguments</key>
	<array>
		<string>example-agent</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>Sockets</key>
	<dict>
		<key>socket-name</key>
		<dict>
			<key>SockPathName</key>
			<string>/Users/test/.openpgp-card-ssh-agent</string>
			<key>SockFamily</key>
			<string>Unix</string>
		</dict>
	</dict>
</dict>
</plist>

The file can be placed in ~/Library/LaunchAgents and loaded via launchctl load ~/Library/LaunchAgents/com.example.agent.plist.

Commit count: 9

cargo fmt