mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Fix restart missing arguments in proc-macro-srv
This commit is contained in:
parent
0ad6b6d407
commit
bd350108b0
1 changed files with 9 additions and 5 deletions
|
@ -9,7 +9,7 @@ use crate::rpc::{ExpansionResult, ExpansionTask, ListMacrosResult, ListMacrosTas
|
||||||
use io::{BufRead, BufReader};
|
use io::{BufRead, BufReader};
|
||||||
use std::{
|
use std::{
|
||||||
convert::{TryFrom, TryInto},
|
convert::{TryFrom, TryInto},
|
||||||
ffi::OsStr,
|
ffi::{OsStr, OsString},
|
||||||
io::{self, Write},
|
io::{self, Write},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::{Child, Command, Stdio},
|
process::{Child, Command, Stdio},
|
||||||
|
@ -35,6 +35,7 @@ struct Task {
|
||||||
|
|
||||||
struct Process {
|
struct Process {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
args: Vec<OsString>,
|
||||||
child: Child,
|
child: Child,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,22 +47,25 @@ impl Drop for Process {
|
||||||
|
|
||||||
impl Process {
|
impl Process {
|
||||||
fn run(
|
fn run(
|
||||||
process_path: PathBuf,
|
path: PathBuf,
|
||||||
args: impl IntoIterator<Item = impl AsRef<OsStr>>,
|
args: impl IntoIterator<Item = impl AsRef<OsStr>>,
|
||||||
) -> io::Result<Process> {
|
) -> io::Result<Process> {
|
||||||
let child = Command::new(&process_path)
|
let args = args.into_iter().map(|s| s.as_ref().into()).collect();
|
||||||
.args(args)
|
|
||||||
|
let child = Command::new(&path)
|
||||||
|
.args(&args)
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.stderr(Stdio::null())
|
.stderr(Stdio::null())
|
||||||
.spawn()?;
|
.spawn()?;
|
||||||
|
|
||||||
Ok(Process { path: process_path, child })
|
Ok(Process { path, args, child })
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restart(&mut self) -> io::Result<()> {
|
fn restart(&mut self) -> io::Result<()> {
|
||||||
let _ = self.child.kill();
|
let _ = self.child.kill();
|
||||||
self.child = Command::new(&self.path)
|
self.child = Command::new(&self.path)
|
||||||
|
.args(&self.args)
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.stderr(Stdio::null())
|
.stderr(Stdio::null())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue