Skip to content

Propagate output directory creation failures - #9216

Open
xThreeh wants to merge 1 commit into
google:masterfrom
xThreeh:fix-flatc-output-directory-errors
Open

Propagate output directory creation failures#9216
xThreeh wants to merge 1 commit into
google:masterfrom
xThreeh:fix-flatc-output-directory-errors

Conversation

@xThreeh

@xThreeh xThreeh commented Sep 2, 2026

Copy link
Copy Markdown

flatc currently ignores failures while creating the output directory. If an intermediate path component is a file, generation reports an error but the process can still finish successfully.

This change checks the output directory after EnsureDirExists() and propagates the failure through Compile(). It also adds a focused regression covering a valid output directory and an invalid path.

Validation:

  • Built flatc with CMake/Ninja.
  • The focused regression passes.
  • Valid generation returns 0 and creates the generated header.
  • Invalid output returns non-zero and creates no generated file.
  • git diff --check passes.

The full native test target compiles, but the existing JSON golden comparison in monster_test.cpp:829 currently fails independently of this change.

Fixes #9022

@github-actions github-actions Bot added python c++ codegen Involving generating code from schema labels Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] utils / EnsureDirExists silently ignores errors

1 participant