aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_proc_macro/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_proc_macro/src')
-rw-r--r--crates/ra_proc_macro/src/process.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/ra_proc_macro/src/process.rs b/crates/ra_proc_macro/src/process.rs
index e24944af4..97ba196b8 100644
--- a/crates/ra_proc_macro/src/process.rs
+++ b/crates/ra_proc_macro/src/process.rs
@@ -9,7 +9,7 @@ use crate::rpc::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTas
9use io::{BufRead, BufReader}; 9use io::{BufRead, BufReader};
10use std::{ 10use std::{
11 convert::{TryFrom, TryInto}, 11 convert::{TryFrom, TryInto},
12 ffi::OsStr, 12 ffi::{OsStr, OsString},
13 io::{self, Write}, 13 io::{self, Write},
14 path::{Path, PathBuf}, 14 path::{Path, PathBuf},
15 process::{Child, Command, Stdio}, 15 process::{Child, Command, Stdio},
@@ -35,6 +35,7 @@ struct Task {
35 35
36struct Process { 36struct Process {
37 path: PathBuf, 37 path: PathBuf,
38 args: Vec<OsString>,
38 child: Child, 39 child: Child,
39} 40}
40 41
@@ -46,22 +47,25 @@ impl Drop for Process {
46 47
47impl Process { 48impl Process {
48 fn run( 49 fn run(
49 process_path: PathBuf, 50 path: PathBuf,
50 args: impl IntoIterator<Item = impl AsRef<OsStr>>, 51 args: impl IntoIterator<Item = impl AsRef<OsStr>>,
51 ) -> io::Result<Process> { 52 ) -> io::Result<Process> {
52 let child = Command::new(&process_path) 53 let args = args.into_iter().map(|s| s.as_ref().into()).collect();
53 .args(args) 54
55 let child = Command::new(&path)
56 .args(&args)
54 .stdin(Stdio::piped()) 57 .stdin(Stdio::piped())
55 .stdout(Stdio::piped()) 58 .stdout(Stdio::piped())
56 .stderr(Stdio::null()) 59 .stderr(Stdio::null())
57 .spawn()?; 60 .spawn()?;
58 61
59 Ok(Process { path: process_path, child }) 62 Ok(Process { path, args, child })
60 } 63 }
61 64
62 fn restart(&mut self) -> io::Result<()> { 65 fn restart(&mut self) -> io::Result<()> {
63 let _ = self.child.kill(); 66 let _ = self.child.kill();
64 self.child = Command::new(&self.path) 67 self.child = Command::new(&self.path)
68 .args(&self.args)
65 .stdin(Stdio::piped()) 69 .stdin(Stdio::piped())
66 .stdout(Stdio::piped()) 70 .stdout(Stdio::piped())
67 .stderr(Stdio::null()) 71 .stderr(Stdio::null())