Skip to content

Docs: fix README to use strings(), document separator behavior#310

Merged
iCharlesHu merged 1 commit into
swiftlang:mainfrom
nenadvulic:fix-286-readme-strings-docs
Jun 11, 2026
Merged

Docs: fix README to use strings(), document separator behavior#310
iCharlesHu merged 1 commit into
swiftlang:mainfrom
nenadvulic:fix-286-readme-strings-docs

Conversation

@nenadvulic

Copy link
Copy Markdown
Contributor

Refs #286.

README: several examples used execution.standardOutput.lines(), but the API is strings(separatedBy:bufferingPolicy:) / strings(separatedBy:bufferingPolicy:as:) — there is no lines(), so those snippets don't compile. This aligns them with the shipping API, including the parameterized form where the encoding is passed via as: (not encoding:):

for try await line in execution.standardOutput.strings(
    bufferingPolicy: .maxLineLength(1024),
    as: UTF16.self
) { ... }

Doc comment: strings() didn't state whether the separator is kept. Added a note that the separator characters are not included in the returned strings, matching the existing StringSequence type documentation.

Docs-only change. I've intentionally left the strings()lines() rename proposed in #286 to the maintainers — happy to follow up with that if you'd like to go that way (in which case the README would move the other direction).

The README used execution.standardOutput.lines() in several examples, but
the API is strings(separatedBy:bufferingPolicy:[as:]) — lines() does not
exist, so those snippets did not compile. Align them with the shipping API
(including the parameterized form: encoding is passed via 'as:').

Also clarify on strings() that the separator characters are not included in
the returned strings, matching the StringSequence type documentation.

Refs swiftlang#286. (Leaves the strings()->lines() rename proposal to the maintainers.)
@nenadvulic nenadvulic requested a review from iCharlesHu as a code owner June 11, 2026 10:02

@iCharlesHu iCharlesHu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@iCharlesHu iCharlesHu merged commit 8754744 into swiftlang:main Jun 11, 2026
46 checks passed
@nenadvulic nenadvulic deleted the fix-286-readme-strings-docs branch June 11, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants