Skip to content

Commit 60757a8

Browse files
committed
Document how we obtain the name of the cabal config file.
1 parent b1dc5f1 commit 60757a8

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

dist/index.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/setup-haskell.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/setup-haskell.ts

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ async function cabalConfig(): Promise<string> {
1616
silent: true,
1717
listeners: {stdout: append, stderr: append}
1818
});
19+
// The last line of the cabal help text is printing the config file, e.g.:
20+
//
21+
// > You can edit the cabal configuration file to set defaults:
22+
// > <<HOME>>/.cabal/config
23+
//
24+
// So trimming the last line will give us the name of the config file.
25+
//
26+
// Needless to say this is very brittle, but we secure this by a test
27+
// in Cabal's testsuite: https://github.com/haskell/cabal/pull/9614
1928
return out.toString().trim().split('\n').slice(-1)[0].trim();
2029
}
2130

0 commit comments

Comments
 (0)