mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
add the paste function for Linux
This commit is contained in:
parent
3c636dabe5
commit
9360c11dd1
3 changed files with 133 additions and 222 deletions
|
@ -40,20 +40,7 @@ pub struct StdinReader {
|
|||
impl StdinReader {
|
||||
#[cfg(all(target_os = "linux", feature = "full-repl"))]
|
||||
fn access_clipboard() -> Option<Output> {
|
||||
if let Ok(str) = std::fs::read("/proc/sys/kernel/osrelease") {
|
||||
if let Ok(str) = std::str::from_utf8(&str) {
|
||||
if str.to_ascii_lowercase().contains("microsoft") {
|
||||
return Some(
|
||||
Command::new("powershell")
|
||||
.args(["get-clipboard"])
|
||||
.output()
|
||||
.expect("failed to get clipboard"),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Command::new("xsel")
|
||||
.args(["--output", "--clipboard"])
|
||||
Command::new("inclip")
|
||||
.output()
|
||||
.ok()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue