Skip to content

Add some flags to example, fix version issue #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2025

Conversation

gspencergoog
Copy link
Contributor

@gspencergoog gspencergoog commented May 13, 2025

Description

Adds --help, --log, and --model flags to the workflow example and fixes a problem where the examples would only connect to servers with the latest protocol version (instead of any supported version).

Copy link

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

}
Sink<String>? logSink;
logFile.createSync(recursive: true);
final fileByteSink = logFile.openWrite(
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to confirm, this will actually write the bytes to disk relatively quickly when we write to the sink? Do we need to call flush or anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. It will be buffered by default, but I guess we do want it to be pretty up-to-date. I don't think I can turn off the buffering on the file descriptor. I added a call to flush each time something is added to the sink.

Copy link
Contributor

Choose a reason for hiding this comment

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

When I did this previously I just did regular writes in append mode for each line that came in, instead of keeping it open like this. In theory this is better though, but we do want to actually see the logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flushing should do that, and this is only in the example.

I did look at doing the flush where we do the adding to the sink in the main package, but then we'd have to change the Sink<String> to an IOSink, since the base Sink doesn't have flush(), which would be a breaking change.

@jakemac53
Copy link
Contributor

LGTM with some final nits

@gspencergoog
Copy link
Contributor Author

FYI, @jakemac53 I don't have permissions to submit the PR, so just submit when you're happy with it.

@jakemac53 jakemac53 merged commit 02796a1 into dart-lang:main May 13, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants