Skip to content

Commit 8b9e4c3

Browse files
committed
Explain configlet command in comment
1 parent a2ef137 commit 8b9e4c3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

contribution/generator/src/TrackData/PracticeExercise.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ private function ensurePracticeExerciseCanBeUsed(): void
101101

102102
private function pathToCachedCanonicalDataFromConfiglet(): void
103103
{
104+
/*
105+
When running configlet with detailed output (-v d) and a command that
106+
requires problem specification data (e.g. info), it prints the location
107+
of the cache as the first line. To avoid an HTTP call, use the offline
108+
mode (-o).
109+
110+
Pipe the output through 'head' to get the first line only, then 'cut'
111+
the 5th field to get the path only.
112+
113+
configlet may fail when there is no cached data (offline mode), which
114+
tells us, that the exercise hasn't been generated before (the cache is
115+
required for that, too). So BASH must use `-eo pipefail` to get the
116+
failure code back.
117+
*/
104118
$command = 'bash -c \'set -eo pipefail; '
105119
. $this->pathToConfiglet
106120
. ' -v d -t '

0 commit comments

Comments
 (0)