diff options
author | Carlos Tuñón <camotubi@gmail.com> | 2019-01-05 15:47:12 -0500 |
---|---|---|
committer | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-01-05 20:47:12 +0000 |
commit | e4dc43e87c5330c1f22dc2e7570d7e66881ef647 (patch) | |
tree | b8bfa95519ac71845d5ed2bc873cfdd57dc27993 /src/util.rs | |
parent | f4fc9eb35a02426dac33a19e2cb9ff182d745316 (diff) | |
download | alacritty-e4dc43e87c5330c1f22dc2e7570d7e66881ef647.tar.gz alacritty-e4dc43e87c5330c1f22dc2e7570d7e66881ef647.zip |
Add key/mouse action for spawning new Alacritty instances
Diffstat (limited to 'src/util.rs')
-rw-r--r-- | src/util.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/util.rs b/src/util.rs index 0b3b6644..2b30ce8d 100644 --- a/src/util.rs +++ b/src/util.rs @@ -14,6 +14,7 @@ #[cfg(not(windows))] use std::os::unix::process::CommandExt; use std::process::Command; +use std::ffi::OsStr; use std::{cmp, io}; /// Threading utilities @@ -77,7 +78,11 @@ pub mod fmt { } #[cfg(not(windows))] -pub fn start_daemon(program: &str, args: &[String]) -> io::Result<()> { +pub fn start_daemon<I, S>(program: &str, args: I) -> io::Result<()> + where + I: IntoIterator<Item = S>, + S: AsRef<OsStr>, +{ Command::new(program) .args(args) .before_exec(|| unsafe { @@ -90,7 +95,11 @@ pub fn start_daemon(program: &str, args: &[String]) -> io::Result<()> { } #[cfg(windows)] -pub fn start_daemon(program: &str, args: &[String]) -> io::Result<()> { +pub fn start_daemon<I, S>(program: &str, args: I) -> io::Result<()> + where + I: IntoIterator<Item = S>, + S: AsRef<OsStr>, +{ Command::new(program).args(args).spawn().map(|_| ()) } |