Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit edf532ca authored by Simon Chan's avatar Simon Chan
Browse files

fix(stream): re-export global `TextDecoder` stream instead of implementing our...

fix(stream): re-export global `TextDecoder` stream instead of implementing our own one which doesn't work correctly in stream mode
parent 7bb1063a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
{
    "changes": [
        {
            "packageName": "@yume-chan/stream-extra",
            "comment": "Re-export global `TextDecoderStream` instead of implementing our own one which doesn't work correctly in stream mode",
            "type": "none"
        }
    ],
    "packageName": "@yume-chan/stream-extra"
}
+2 −2
Original line number Diff line number Diff line
@@ -29,10 +29,10 @@ import type {
import {
    AbortController,
    BufferedReadableStream,
    DecodeUtf8Stream,
    InspectStream,
    PushReadableStream,
    SplitStringStream,
    TextDecoderStream,
    WritableStream,
} from "@yume-chan/stream-extra";

@@ -158,7 +158,7 @@ export class AdbScrcpyClient {
            );

            const stdout = process.stdout
                .pipeThrough(new DecodeUtf8Stream())
                .pipeThrough(new TextDecoderStream())
                .pipeThrough(new SplitStringStream("\n"));

            // Must read all streams, otherwise the whole connection will be blocked.
+2 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ import type {
    MaybeConsumable,
    ReadableWritablePair,
} from "@yume-chan/stream-extra";
import { ConcatStringStream, DecodeUtf8Stream } from "@yume-chan/stream-extra";
import { ConcatStringStream, TextDecoderStream } from "@yume-chan/stream-extra";
import type { ValueOrPromise } from "@yume-chan/struct";

import type { AdbBanner } from "./banner.js";
@@ -112,7 +112,7 @@ export class Adb implements Closeable {
    async createSocketAndWait(service: string): Promise<string> {
        const socket = await this.createSocket(service);
        return await socket.readable
            .pipeThrough(new DecodeUtf8Stream())
            .pipeThrough(new TextDecoderStream())
            .pipeThrough(new ConcatStringStream());
    }

+3 −3
Original line number Diff line number Diff line
import { ConcatStringStream, DecodeUtf8Stream } from "@yume-chan/stream-extra";
import { ConcatStringStream, TextDecoderStream } from "@yume-chan/stream-extra";

import { AdbCommandBase } from "../base.js";

@@ -112,10 +112,10 @@ export class AdbSubprocess extends AdbCommandBase {

        const [stdout, stderr, exitCode] = await Promise.all([
            process.stdout
                .pipeThrough(new DecodeUtf8Stream())
                .pipeThrough(new TextDecoderStream())
                .pipeThrough(new ConcatStringStream()),
            process.stderr
                .pipeThrough(new DecodeUtf8Stream())
                .pipeThrough(new TextDecoderStream())
                .pipeThrough(new ConcatStringStream()),
            process.exit,
        ]);
+2 −2
Original line number Diff line number Diff line
import type { Adb } from "@yume-chan/adb";
import { AdbCommandBase } from "@yume-chan/adb";
import { ConcatStringStream, DecodeUtf8Stream } from "@yume-chan/stream-extra";
import { ConcatStringStream, TextDecoderStream } from "@yume-chan/stream-extra";

import { Cmd } from "./cmd.js";
import type { IntentBuilder } from "./intent.js";
@@ -53,7 +53,7 @@ export class ActivityManager extends AdbCommandBase {
        const process = await this.#cmdOrSubprocess(args);

        const output = await process.stdout
            .pipeThrough(new DecodeUtf8Stream())
            .pipeThrough(new TextDecoderStream())
            .pipeThrough(new ConcatStringStream())
            .then((output) => output.trim());

Loading