git.delta.rocks / remowt / refs/commits / 61cfb317f078

difftreelog

fix rofi cancellation

xwvqqwwvYaroslav Bolyukin3 days agoparent: #023a07f.patch.diff
in: trunk

2 files changed

modifiedcrates/remowt-client/src/subprocess.rsdiffbeforeafterboth
64 drop(stdin);64 drop(stdin);
65 let drain_out = async move {65 let drain_out = async move {
66 if let Some(s) = stdout {66 if let Some(s) = stdout {
67 drain_to_tracing(s, "<child stdout>".to_owned(), false).await;67 let _ = drain_to_tracing(s, "<child stdout>".to_owned(), false).await;
68 }68 }
69 };69 };
70 let drain_err = async move {70 let drain_err = async move {
71 if let Some(s) = stderr {71 if let Some(s) = stderr {
72 drain_to_tracing(s, "<child stderr>".to_owned(), true).await;72 let _ = drain_to_tracing(s, "<child stderr>".to_owned(), true).await;
73 }73 }
74 };74 };
75 let wait = async move {75 let wait = async move {
modifiedcrates/remowt-ui-prompt/src/rofi.rsdiffbeforeafterboth
--- a/crates/remowt-ui-prompt/src/rofi.rs
+++ b/crates/remowt-ui-prompt/src/rofi.rs
@@ -46,7 +46,7 @@
 			"-mesg",
 			&mesg,
 			"-sync",
-			"-only-match",
+			"-no-custom",
 			"-p",
 			fixup_prompt(prompt),
 			"-format",
@@ -79,6 +79,15 @@
 			.wait_with_output()
 			.await
 			.map_err(|e| Error::InputError(format!("failed to wait for rofi: {e}")))?;
+		match out.status.code() {
+			Some(0) => {}
+			Some(1) => return Err(Error::Cancel),
+			other => {
+				return Err(Error::InputError(format!(
+					"rofi exited with status {other:?}"
+				)));
+			}
+		}
 		let stdout = out
 			.stdout
 			.strip_suffix(b"\n")
@@ -133,6 +142,15 @@
 			.wait_with_output()
 			.await
 			.map_err(|e| Error::InputError(format!("failed to wait for rofi: {e}")))?;
+		match out.status.code() {
+			Some(0) => {}
+			Some(1) => return Err(Error::Cancel),
+			other => {
+				return Err(Error::InputError(format!(
+					"rofi exited with status {other:?}"
+				)));
+			}
+		}
 		let stdout = out
 			.stdout
 			.strip_suffix(b"\n")