f3ath / cider

Tools for Dart package maintainers
https://pub.dev/packages/cider
MIT License
101 stars 17 forks source link

Fix: abort root folder search upon reaching filesystem root #51

Closed maltevesper closed 1 year ago

maltevesper commented 1 year ago

On Linux I experienced the findroot function looping for ever and not aborting upon reaching the filesystem root. The following patch is an attempt to fix this.

maltevesper commented 1 year ago

fixes #49 (Turns the stackoverflow into a debugtrace), output after fix:

Bad state: Can not find project root
#0      Cider._findRoot
cider.dart:35
#1      new Cider.<anonymous closure>
cider.dart:20
#2      Singleton.call
singleton.dart:11
#3      ContainerMixin.get
container.dart:28
#4      PubspecService.install.<anonymous closure>
pubspec_service.dart:28
#5      Singleton.call
singleton.dart:11
#6      ContainerMixin.get
container.dart:28
#7      PubspecService.install.<anonymous closure>
pubspec_service.dart:35
#8      Cider.run
cider.dart:72
<asynchronous suspension>
#9      main
cider.dart:6
<asynchronous suspension>
f3ath commented 1 year ago

Thank you! Would it be possible to add a test case for this?

maltevesper commented 1 year ago

@f3ath you move to quickly... (But hey accepted pull requests are nice) I had a go at adding a test case, and rebased the branch so that one could do a before and after (I.e. first commit is the test which fails on the old code, second commit is the fix).

Going to make a new pr for the test.