mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 15:56:28 +00:00
fix(haskell): avoid creating .lock files or downloading GHC (#1147)
* (Haskell) avoid creating .lock files or downloading GHC * Fix stack command in mock expectations for Haskell module + befriend cargo fmt
This commit is contained in:
parent
8c17f7b97c
commit
8e8519552f
@ -22,7 +22,14 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
|
|||||||
|
|
||||||
let haskell_version = utils::exec_cmd(
|
let haskell_version = utils::exec_cmd(
|
||||||
"stack",
|
"stack",
|
||||||
&["ghc", "--", "--numeric-version", "--no-install-ghc"],
|
&[
|
||||||
|
"--no-install-ghc",
|
||||||
|
"--lock-file",
|
||||||
|
"read-only",
|
||||||
|
"ghc",
|
||||||
|
"--",
|
||||||
|
"--numeric-version",
|
||||||
|
],
|
||||||
)?
|
)?
|
||||||
.stdout;
|
.stdout;
|
||||||
let formatted_version = Some(format!("v{}", haskell_version.trim()))?;
|
let formatted_version = Some(format!("v{}", haskell_version.trim()))?;
|
||||||
|
10
src/utils.rs
10
src/utils.rs
@ -73,10 +73,12 @@ pub fn exec_cmd(cmd: &str, args: &[&str]) -> Option<CommandOutput> {
|
|||||||
stdout: String::from("ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]"),
|
stdout: String::from("ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]"),
|
||||||
stderr: String::default(),
|
stderr: String::default(),
|
||||||
}),
|
}),
|
||||||
"stack ghc -- --numeric-version --no-install-ghc" => Some(CommandOutput {
|
"stack --no-install-ghc --lock-file read-only ghc -- --numeric-version" => {
|
||||||
stdout: String::from("8.6.5"),
|
Some(CommandOutput {
|
||||||
stderr: String::default(),
|
stdout: String::from("8.6.5"),
|
||||||
}),
|
stderr: String::default(),
|
||||||
|
})
|
||||||
|
}
|
||||||
"elixir --version" => Some(CommandOutput {
|
"elixir --version" => Some(CommandOutput {
|
||||||
stdout: String::from(
|
stdout: String::from(
|
||||||
"\
|
"\
|
||||||
|
Loading…
Reference in New Issue
Block a user