Skip to content

Commit

Permalink
Explain configlet command in comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mk-mxp committed Feb 26, 2024
1 parent 909e79b commit 05f3890
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions contribution/generator/src/TrackData/PracticeExercise.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ private function ensurePracticeExerciseCanBeUsed(): void

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

0 comments on commit 05f3890

Please sign in to comment.