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.rs20
1 files changed, 12 insertions, 8 deletions
diff --git a/crates/flycheck/src/test_runner.rs b/crates/flycheck/src/test_runner.rs
index 94c05ebc74..c136dd1366 100644
--- a/crates/flycheck/src/test_runner.rs
+++ b/crates/flycheck/src/test_runner.rs
@@ -3,7 +3,8 @@
use std::process::Command;
-use crossbeam_channel::Receiver;
+use crossbeam_channel::Sender;
+use paths::AbsPath;
use serde::Deserialize;
use toolchain::Tool;
@@ -54,20 +55,27 @@ 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>, options: CargoOptions) -> 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 {
@@ -75,10 +83,6 @@ impl CargoTestHandle {
}
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)? })
}
}