This commit is contained in:
MedzikUserBot 2022-02-26 21:51:41 +00:00
parent a4a17a4fc5
commit 2c22737070
1 changed files with 10 additions and 2 deletions

View File

@ -3,7 +3,10 @@
not(any(target_os = "macos", target_os = "android", target_os = "emscripten"))
))]
pub fn set_clipboard(content: String) {
use std::{process::{Command, Stdio}, io::Write};
use std::{
io::Write,
process::{Command, Stdio},
};
let mut child = Command::new("xsel")
.arg("--input")
@ -12,7 +15,12 @@ pub fn set_clipboard(content: String) {
.spawn()
.expect("execute command xsel");
child.stdin.as_mut().unwrap().write_all(content.as_bytes()).expect("execute command");
child
.stdin
.as_mut()
.unwrap()
.write_all(content.as_bytes())
.expect("execute command");
child.wait_with_output().unwrap();
}