Fix extern_process args

This commit is contained in:
Edwin Cheng 2020-04-17 04:08:01 +08:00
parent 177becea98
commit b4c5ee33ae
2 changed files with 22 additions and 8 deletions

View file

@ -12,6 +12,7 @@ pub mod msg;
use process::{ProcMacroProcessSrv, ProcMacroProcessThread};
use ra_tt::{SmolStr, Subtree};
use std::{
ffi::OsStr,
path::{Path, PathBuf},
sync::Arc,
};
@ -56,10 +57,14 @@ pub struct ProcMacroClient {
}
impl ProcMacroClient {
pub fn extern_process<T: AsRef<str>>(
pub fn extern_process<I, S>(
process_path: &Path,
args: &[T],
) -> Result<ProcMacroClient, std::io::Error> {
args: I,
) -> Result<ProcMacroClient, std::io::Error>
where
I: IntoIterator<Item = S>,
S: AsRef<OsStr>,
{
let (thread, process) = ProcMacroProcessSrv::run(process_path, args)?;
Ok(ProcMacroClient {
kind: ProcMacroClientKind::Process { process: Arc::new(process), thread },