Skip to content

Commit

Permalink
vopono v0.6.1 - Hotfix for pactl parse errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcm committed Dec 2, 2020
1 parent 053978e commit 8d6baf0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "vopono"
description = "Launch applications via VPN tunnels using temporary network namespaces"
version = "0.6.0"
version = "0.6.1"
authors = ["James McMurray <[email protected]>"]
edition = "2018"
license = "GPL-3.0-or-later"
Expand Down
13 changes: 10 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod wireguard;

use list::output_list;
use list_configs::print_configs;
use log::{debug, LevelFilter};
use log::{debug, warn, LevelFilter};
use netns::NetworkNamespace;
use structopt::StructOpt;
use sync::{sync_menu, synch};
Expand Down Expand Up @@ -52,8 +52,15 @@ fn main() -> anyhow::Result<()> {
args::Command::Exec(cmd) => {
clean_dead_locks()?;
if which("pactl").is_ok() {
let pa = pulseaudio::get_pulseaudio_server()?;
std::env::set_var("PULSE_SERVER", pa);
let pa = pulseaudio::get_pulseaudio_server();
if let Ok(pa) = pa {
std::env::set_var("PULSE_SERVER", pa);
} else {
warn!(
"Could not parse PULSE_SERVER from pactl info output: {:?}",
pa
);
}
} else {
debug!("pactl not found, will not set PULSE_SERVER");
}
Expand Down
4 changes: 2 additions & 2 deletions src/pulseaudio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ pub fn get_pulseaudio_server() -> anyhow::Result<String> {

let caps = re.captures(output);
if caps.is_none() {
return Err(anyhow!("Could not parse pactl output!"));
return Err(anyhow!("Could not parse pactl output!:\n{}", output));
}
let caps = caps.unwrap().get(1);
if caps.is_none() {
return Err(anyhow!("Could not parse pactl output!"));
return Err(anyhow!("Could not parse pactl output!:\n{}", output));
}

let out = caps.unwrap().as_str().to_string();
Expand Down

0 comments on commit 8d6baf0

Please sign in to comment.