Skip to content

Commit

Permalink
tweak(stdlib): better error reporting in xod/xommon-hardware/sd-log
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenykochetkov committed Nov 12, 2018
1 parent 5ea4f33 commit 8bb557f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions workspace/__lib__/xod/common-hardware/sd-log/patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,15 @@ void evaluate(Context ctx) {
}

XString line = getValue<input_LINE>(ctx);
for (auto it = line.iterate(); it; ++it)
file.print(*it);
size_t lastWriteSize;
for (auto it = line.iterate(); it; ++it) {
lastWriteSize = file.print(*it);
if (lastWriteSize == 0) {
state->begun = false;
emitValue<output_ERR>(ctx, true);
return;
}
}

file.print('\n');
file.flush();
Expand Down

0 comments on commit 8bb557f

Please sign in to comment.