summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOisín <denpashogai@gmail.com>2020-04-28 09:07:18 +0100
committerGitHub <noreply@github.com>2020-04-28 10:07:18 +0200
commit8e8519552f32313eacc835b8526aa44655c7904c (patch)
tree11fb50650f94dbb5d9f92adf5936ae9634fc04d9
parent8c17f7b97c1f59ac65f20aa4cc866bb19f1b9fc6 (diff)
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
-rw-r--r--src/modules/haskell.rs9
-rw-r--r--src/utils.rs10
2 files changed, 14 insertions, 5 deletions
diff --git a/src/modules/haskell.rs b/src/modules/haskell.rs
index 40d87d8d0..0e41d6b75 100644
--- a/src/modules/haskell.rs
+++ b/src/modules/haskell.rs
@@ -22,7 +22,14 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
let haskell_version = utils::exec_cmd(
"stack",
- &["ghc", "--", "--numeric-version", "--no-install-ghc"],
+ &[
+ "--no-install-ghc",
+ "--lock-file",
+ "read-only",
+ "ghc",
+ "--",
+ "--numeric-version",
+ ],
)?
.stdout;
let formatted_version = Some(format!("v{}", haskell_version.trim()))?;
diff --git a/src/utils.rs b/src/utils.rs
index 37444fab7..b4aa18086 100644
--- a/src/utils.rs
+++ b/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]"),
stderr: String::default(),
}),
- "stack ghc -- --numeric-version --no-install-ghc" => Some(CommandOutput {
- stdout: String::from("8.6.5"),
- stderr: String::default(),
- }),
+ "stack --no-install-ghc --lock-file read-only ghc -- --numeric-version" => {
+ Some(CommandOutput {
+ stdout: String::from("8.6.5"),
+ stderr: String::default(),
+ })
+ }
"elixir --version" => Some(CommandOutput {
stdout: String::from(
"\