onepub-dev / dcli

An extensive library and tooling for building console/cli applications and scripts using the Dart programming language.
245 stars 28 forks source link

fix ProgressMixin.firstLine throwing if there are no lines #248

Closed sstasi95 closed 3 months ago

sstasi95 commented 3 months ago

This PR makes ProgressMixin.firstLine return lines.firstOrNull instead of lines.first, returning null if the command returned no lines, which is the expected behavior according to the doc comment.

An example command that would throw and that is fixed by this PR is:

'grep abc empty.txt'.start(nothrow: true).firstLine;
sstasi95 commented 3 months ago

@bsutton let me know if I should add a test for this.

bsutton commented 3 months ago

released in 4.0.3 - thanks for the assist :)