Skip to content

fix(learn): prevent errexit on '((completed++))'#601

Merged
Chemaclass merged 1 commit intoTypedDevs:mainfrom
meleu:fix/learn-show-progress
Mar 10, 2026
Merged

fix(learn): prevent errexit on '((completed++))'#601
Chemaclass merged 1 commit intoTypedDevs:mainfrom
meleu:fix/learn-show-progress

Conversation

@meleu
Copy link
Contributor

@meleu meleu commented Mar 10, 2026

📚 Description

Run bashunit learn, complete the first lesson, and then check your progress... 💥

bashunit-learn-bug-2026-03-10_06.30.12.mp4

The problem is caused by the exit status of ((completed++)), which is non-zero if you have any lesson completed. This causes errexit.

The expected result (which I got after the fix) is to see the list of completed lessons and then back to the bashunit learn prompt, like this:

Enter your choice:
p

Your Progress:

  ✓ Lesson 1 completed
  ○ Lesson 2
  ○ Lesson 3
  ○ Lesson 4
  ○ Lesson 5
  ○ Lesson 6
  ○ Lesson 7
  ○ Lesson 8
  ○ Lesson 9
  ○ Lesson 10

Progress: 1/10 lessons completed
Press Enter to continue...

🔖 Changes

Simply added || true, as it seems to be the common practice in other places of the codebase.

I also noticed that there isn't any test validating the bashunit learn behavior, then I didn't add any for such a simple fix.

✅ To-do list

  • I updated the CHANGELOG.md to reflect the new feature or fix
  • I updated the documentation to reflect the changes

@Chemaclass Chemaclass added the bug Something isn't working label Mar 10, 2026
Copy link
Member

@Chemaclass Chemaclass left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@Chemaclass Chemaclass merged commit eea58d2 into TypedDevs:main Mar 10, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants