Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/flycheck/src/test_runner.rs')
| -rw-r--r-- | crates/flycheck/src/test_runner.rs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/crates/flycheck/src/test_runner.rs b/crates/flycheck/src/test_runner.rs index 9f761c9ead..c136dd1366 100644 --- a/crates/flycheck/src/test_runner.rs +++ b/crates/flycheck/src/test_runner.rs @@ -3,11 +3,15 @@ use std::process::Command; -use crossbeam_channel::Receiver; +use crossbeam_channel::Sender; +use paths::AbsPath; use serde::Deserialize; use toolchain::Tool; -use crate::command::{CommandHandle, ParseFromLine}; +use crate::{ + command::{CommandHandle, ParseFromLine}, + CargoOptions, +}; #[derive(Debug, Deserialize)] #[serde(tag = "event", rename_all = "camelCase")] @@ -51,30 +55,34 @@ impl ParseFromLine for CargoTestMessage { #[derive(Debug)] pub struct CargoTestHandle { - handle: CommandHandle<CargoTestMessage>, + _handle: CommandHandle<CargoTestMessage>, } // Example of a cargo test command: // cargo test --workspace --no-fail-fast -- module::func -Z unstable-options --format=json impl CargoTestHandle { - pub fn new(path: Option<&str>) -> std::io::Result<Self> { + pub fn new( + path: Option<&str>, + options: CargoOptions, + root: &AbsPath, + sender: Sender<CargoTestMessage>, + ) -> std::io::Result<Self> { let mut cmd = Command::new(Tool::Cargo.path()); cmd.env("RUSTC_BOOTSTRAP", "1"); cmd.arg("test"); cmd.arg("--workspace"); // --no-fail-fast is needed to ensure that all requested tests will run cmd.arg("--no-fail-fast"); + cmd.arg("--manifest-path"); + cmd.arg(root.join("Cargo.toml")); + options.apply_on_command(&mut cmd); cmd.arg("--"); if let Some(path) = path { cmd.arg(path); } cmd.args(["-Z", "unstable-options"]); cmd.arg("--format=json"); - Ok(Self { handle: CommandHandle::spawn(cmd)? }) - } - - pub fn receiver(&self) -> &Receiver<CargoTestMessage> { - &self.handle.receiver + Ok(Self { _handle: CommandHandle::spawn(cmd, sender)? }) } } |