mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 00:48:35 +00:00
Fix freeze on copy when xclip is installed on Linux
This commit is contained in:
parent
f8e1c26309
commit
45bb8a71b5
2 changed files with 15 additions and 3 deletions
|
|
@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
* crash on branches popup in small terminal ([#1470](https://github.com/extrawurst/gitui/issues/1470))
|
||||
* `edit` command duplication ([#1489](https://github.com/extrawurst/gitui/issues/1489))
|
||||
* syntax errors in `key_bindings.ron` will be logged ([#1491](https://github.com/extrawurst/gitui/issues/1491))
|
||||
* Fix UI freeze when copying with xclip installed on Linux ([#1497](https://github.com/extrawurst/gitui/issues/1497))
|
||||
* commit hooks report "command not found" on Windows with wsl2 installed ([#1528](https://github.com/extrawurst/gitui/issues/1528))
|
||||
* crashes on entering submodules ([#1510](https://github.com/extrawurst/gitui/issues/1510))
|
||||
* fix race issue: revlog messages sometimes appear empty ([#1473](https://github.com/extrawurst/gitui/issues/1473))
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ fn exec_copy_with_args(
|
|||
command: &str,
|
||||
args: &[&str],
|
||||
text: &str,
|
||||
pipe_stderr: bool,
|
||||
) -> Result<()> {
|
||||
let binary = which(command)
|
||||
.ok()
|
||||
|
|
@ -17,7 +18,11 @@ fn exec_copy_with_args(
|
|||
.args(args)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::null())
|
||||
.stderr(Stdio::piped())
|
||||
.stderr(if pipe_stderr {
|
||||
Stdio::piped()
|
||||
} else {
|
||||
Stdio::null()
|
||||
})
|
||||
.spawn()
|
||||
.map_err(|e| anyhow!("`{:?}`: {}", command, e))?;
|
||||
|
||||
|
|
@ -45,7 +50,7 @@ fn exec_copy_with_args(
|
|||
}
|
||||
|
||||
fn exec_copy(command: &str, text: &str) -> Result<()> {
|
||||
exec_copy_with_args(command, &[], text)
|
||||
exec_copy_with_args(command, &[], text, true)
|
||||
}
|
||||
|
||||
#[cfg(all(target_family = "unix", not(target_os = "macos")))]
|
||||
|
|
@ -58,10 +63,16 @@ pub fn copy_string(text: &str) -> Result<()> {
|
|||
"xclip",
|
||||
&["-selection", "clipboard"],
|
||||
text,
|
||||
false,
|
||||
)
|
||||
.is_err()
|
||||
{
|
||||
return exec_copy_with_args("xsel", &["--clipboard"], text);
|
||||
return exec_copy_with_args(
|
||||
"xsel",
|
||||
&["--clipboard"],
|
||||
text,
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Reference in a new issue