From 3e3a2e5394a619807f9f4930263ccf4d3fee269a Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 30 Jun 2019 10:53:24 +0000 Subject: Fix input and password dialogs for zenity backend MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we tried to read the user input from zenity’s stderr although it is written to stdout. This patch changes the zenity backend to read from stdout instead of stderr. It also removes trailing newlines from the user input, as zenity adds a newline when writing the input. --- src/backends/zenity.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backends') diff --git a/src/backends/zenity.rs b/src/backends/zenity.rs index 0730c64..85206b3 100644 --- a/src/backends/zenity.rs +++ b/src/backends/zenity.rs @@ -128,8 +128,8 @@ fn get_choice(status: process::ExitStatus) -> Result { fn get_stdout(output: process::Output) -> Result> { if output.status.success() { - String::from_utf8(output.stderr) - .map(|s| Some(s)) + String::from_utf8(output.stdout) + .map(|s| Some(s.trim_end_matches('\n').to_string())) .map_err(|err| Error::from(err)) } else { if let Some(code) = output.status.code() { -- cgit v1.2.3