Skip to content

Commit

Permalink
add missing encoding argument to Command.streamLines (#3582)
Browse files Browse the repository at this point in the history
  • Loading branch information
gcanti authored Sep 10, 2024
1 parent ac9bf46 commit 8261c5a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-dolls-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/platform": patch
---

add missing `encoding` argument to `Command.streamLines`
15 changes: 7 additions & 8 deletions packages/platform/src/Command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ export const feed: {
/**
* Flatten this command to a non-empty array of standard commands.
*
* * For a `StandardCommand`, this simply returns a `1` element array
* * For a `PipedCommand`, all commands in the pipe will be extracted out into
* a array from left to right
* For a `StandardCommand`, this simply returns a `1` element array
* For a `PipedCommand`, all commands in the pipe will be extracted out into
* a array from left to right
*
* @since 1.0.0
* @category combinators
Expand All @@ -169,10 +169,8 @@ export const flatten: (self: Command) => NonEmptyReadonlyArray<StandardCommand>
* @since 1.0.0
* @category execution
*/
export const lines: (
command: Command,
encoding?: string
) => Effect<Array<string>, PlatformError, CommandExecutor> = internal.lines
export const lines: (command: Command, encoding?: string) => Effect<Array<string>, PlatformError, CommandExecutor> =
internal.lines

/**
* Create a command with the specified process name and an optional list of
Expand Down Expand Up @@ -235,7 +233,8 @@ export const stream: (command: Command) => Stream<Uint8Array, PlatformError, Com
* @since 1.0.0
* @category execution
*/
export const streamLines: (command: Command) => Stream<string, PlatformError, CommandExecutor> = internal.streamLines
export const streamLines: (command: Command, encoding?: string) => Stream<string, PlatformError, CommandExecutor> =
internal.streamLines

/**
* Runs the command returning the entire output as a string with the
Expand Down
7 changes: 4 additions & 3 deletions packages/platform/src/internal/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,14 @@ export const start = (
export const stream = (
command: Command.Command
): Stream.Stream<Uint8Array, PlatformError, CommandExecutor.CommandExecutor> =>
Stream.flatMap(commandExecutor.CommandExecutor, (process) => process.stream(command))
Stream.flatMap(commandExecutor.CommandExecutor, (executor) => executor.stream(command))

/** @internal */
export const streamLines = (
command: Command.Command
command: Command.Command,
encoding?: string
): Stream.Stream<string, PlatformError, CommandExecutor.CommandExecutor> =>
Stream.flatMap(commandExecutor.CommandExecutor, (process) => process.streamLines(command))
Stream.flatMap(commandExecutor.CommandExecutor, (executor) => executor.streamLines(command, encoding))

/** @internal */
export const string = dual<
Expand Down

0 comments on commit 8261c5a

Please sign in to comment.