I am getting really spooky, weird behavior from
cargo run --bin mybinary. The spooky part is that I can’t reproduce the behavior intentionally!
The weird part is that every once in awhile
cargo run --bin mybinary creates a copy of
mybinary in the root of the crate, or in an entirely different crate that is is the same directory as the current crate.
I’m running Rust 1.15.1 on macOS Sierra 10.12.3.
My projects basically looked like this (omitting the
. ├── multibin │ ├── Cargo.toml │ └── src │ ├── bin │ │ ├── command_one.rs │ │ └── command_two.rs │ └── lib.rs └── singlebin ├── Cargo.toml └── src └── main.rs
So in one terminal inside the
multibin directory I run:
multibin $ cargo run --bin command_one multibin $ cargo run --bin command_two
And in a different terminal inside the
singlebin directory I run:
singlebin $ cargo run
And then all of a sudden I notice this strange situation:
. ├── multibin │ ├── Cargo.toml │ ├── command_one <-- Extra copy of binary outside target! │ ├── command_two <-- Another one!? │ ├── main <-- WEIRDER -- this is the singlebin binary, named main and in the WRONG CRATE!? │ └── src │ ├── bin │ │ ├── command_one.rs │ │ └── command_two.rs │ └── lib.rs └── singlebin ├── Cargo.toml └── src └── main.rs
So I delete the spooky extra binaries, and subsequent runs don’t make them any more. I try to make completely new projects to duplicate the situation, but I can’t make it happen again. So I write it off as a fluke.
But as I keep making more binaries source files in
multibin/src/bin, every once in awhile binaries will start showing up in the root of the crate again. But I can’t pin down a pattern as to when it happens so that I can reproduce it.