fyne-io/terminal

RFE: Expose exit code from Terminal's shell

schnoddelbotz opened this issue · 5 comments

Hi and thanks for fyne + terminal.

For my use-case it would be very helpful to retrieve the final exit code from the terminal's shell to determine outcome from commands executed in terminal via write().

The attached screenshot shows required changes to make this work (at least on macOS).
It obviously lacks Windows support so far and has no tests - I wanted to check your general thoughts on this before proceeding.

Should you be positive on it, feel free to simply recycle bits from below - or let me know if you'd prefer a PR.
👋

terminal-diff

This could be a good change. I don't see any reason it would not be OK to add it,
As you guessed PR is the way to add features to the repo, also with more safety in case the ExitCode is called before process exited.

Probably some documentation too

Thanks for the quick response - PR done, including Windows support (tested, seems OK), a tiny test and README update.
Given even the screenshots prove that Windows is supported, I also dropped it from TODO section.
Note the repository's "About" message should be enhanced with macOS and Windows, too, IMHO.

Thanks for merging. I just noticed my change dropped coverage by 0.02%.
Made me feel a bit bad ;) thus I attempted to fix it by adding a test for exit codes 0 and 1:
schnoddelbotz@8633352
Please just ping me if you consider it worth a PR 🥂

That would be nice thanks - always good to keep the coverage increasing :)

Closing this as the main fix is in, thanks @schnoddelbotz