Skip to content

init: do not fail if no shell and no GUI is available - #7843

Open
marisn wants to merge 3 commits into
OSGeo:mainfrom
marisn:gui_start_fail
Open

marisn wants to merge 3 commits into
OSGeo:mainfrom
marisn:gui_start_fail

Conversation

@marisn

@marisn marisn commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

check_gui can return None and there is no guard before call gui_process.wait().

As this state can be reached only on a broken setup, it makes sense to just warn user and exit.
Discovered by a wrong Docker usage – not common, but also possible to reach.

Co-authored with Claude Opus 5

Test: env -u DISPLAY grass /path/to/mapset < /dev/null

`check_gui` can return None and there is no guard before call
`gui_process.wait()`.

As this state can be reached only on a broken setup, it makes sense
to just warn user and exit.

Co-authored with Claude Opus 5
@marisn
marisn requested a review from petrasovaa August 24, 2026 13:35
@github-actions github-actions Bot added Python Related code is in Python libraries labels Aug 24, 2026
@marisn marisn changed the title Init: do not fail if no shell and no GUI is available init: do not fail if no shell and no GUI is available Aug 24, 2026
echoix
echoix previously approved these changes Aug 24, 2026

@echoix echoix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't see nothing wrong with this

@petrasovaa
petrasovaa requested review from wenzeslaus and removed request for petrasovaa August 24, 2026 14:15

@wenzeslaus wenzeslaus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Needless to say, this code would need much more work to make it smoother, but this is good for what it does. Definitively a case we want to handle (we already handle the no TTY/no interactive IO case for both GUI and --exec, so this fits right in).

Besides going back to the simple check, possibly also update lib/init/grass.md (around line 118?), which describes the text-mode as unconditional fallback. So perhaps add a condition ("...if [interactive] term... is available...") or describe when GRASS exits with an error.

Comment thread lib/init/grass.py Outdated
Remove unnecessary GUI type check

Co-authored-by: Vaclav Petras <wenzeslaus@gmail.com>
@github-actions github-actions Bot added docs markdown Related to markdown, markdown files labels Aug 30, 2026
@marisn
marisn requested a review from wenzeslaus August 30, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs libraries markdown Related to markdown, markdown files Python Related code is in Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants