fix(gcode): report the real OS error when G-code export fails#11066
Open
BenJule wants to merge 1 commit into
Open
fix(gcode): report the real OS error when G-code export fails#11066BenJule wants to merge 1 commit into
BenJule wants to merge 1 commit into
Conversation
The G-code writer only checked ferror() and always threw 'Is the disk full?', discarding the actual errno from the failed fwrite/fflush. On a multi-colour model that produces a multi-GB .gcode the write can fail for several reasons (full temp volume, read-only path, antivirus lock, disk quota) — all reported as 'disk full', which misleads users. Capture errno at the first failed fwrite/fflush in GCodeOutputStream, expose it via get_last_error(), and include strerror() in the export failure message (e.g. 'No space left on device') while keeping the disk-full hint as fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When G-code export fails, BambuStudio always shows:
This is guessed, not measured.
GCodeOutputStreamonly checksferror()andGCode::export_gcode()discards the realerrnofrom the failedfwrite/fflush. Large multi-colour models produce multi-GB G-code, and the write can fail for several different reasons — a full temp volume, a read-only path, an antivirus/cloud-sync lock, or a disk quota — all of which are reported identically as 'disk full'. Users (this came from a real 4-colour model export on Windows) are left guessing.Fix
errnoat the first failedfwrite/fflushinGCodeOutputStream.get_last_error()(strerror).errnowas recorded.No behavioural change other than a more accurate error message. Small, self-contained:
src/libslic3r/GCode.cpp+GCode.hpp(+25/-3).