@yume-chan/adb 0.0.18 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +54 -0
- package/CHANGELOG.md +25 -1
- package/README.md +220 -103
- package/esm/adb.d.ts +43 -60
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +68 -249
- package/esm/adb.js.map +1 -1
- package/esm/banner.d.ts +17 -0
- package/esm/banner.d.ts.map +1 -0
- package/esm/banner.js +67 -0
- package/esm/banner.js.map +1 -0
- package/esm/commands/base.d.ts +6 -6
- package/esm/commands/base.d.ts.map +1 -1
- package/esm/commands/base.js +8 -8
- package/esm/commands/framebuffer.d.ts +53 -53
- package/esm/commands/framebuffer.d.ts.map +1 -1
- package/esm/commands/framebuffer.js +46 -46
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +7 -8
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +7 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/power.d.ts +22 -22
- package/esm/commands/power.js +48 -48
- package/esm/commands/reverse.d.ts +40 -28
- package/esm/commands/reverse.d.ts.map +1 -1
- package/esm/commands/reverse.js +130 -100
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/command.d.ts +57 -51
- package/esm/commands/subprocess/command.d.ts.map +1 -1
- package/esm/commands/subprocess/command.js +86 -80
- package/esm/commands/subprocess/command.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +3 -3
- package/esm/commands/subprocess/index.js +3 -3
- package/esm/commands/subprocess/protocols/index.d.ts +3 -3
- package/esm/commands/subprocess/protocols/index.js +3 -3
- package/esm/commands/subprocess/protocols/none.d.ts +30 -35
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/none.js +65 -55
- package/esm/commands/subprocess/protocols/none.js.map +1 -1
- package/esm/commands/subprocess/protocols/shell.d.ts +33 -38
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/shell.js +172 -162
- package/esm/commands/subprocess/protocols/shell.js.map +1 -1
- package/esm/commands/subprocess/protocols/types.d.ts +48 -49
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/types.js +1 -1
- package/esm/commands/subprocess/utils.d.ts +1 -1
- package/esm/commands/subprocess/utils.js +18 -18
- package/esm/commands/sync/index.d.ts +8 -7
- package/esm/commands/sync/index.d.ts.map +1 -1
- package/esm/commands/sync/index.js +8 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +42 -40
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +67 -47
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +13 -11
- package/esm/commands/sync/pull.d.ts.map +1 -1
- package/esm/commands/sync/pull.js +35 -37
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +57 -7
- package/esm/commands/sync/push.d.ts.map +1 -1
- package/esm/commands/sync/push.js +89 -22
- package/esm/commands/sync/push.js.map +1 -1
- package/esm/commands/sync/request.d.ts +26 -23
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +40 -42
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +19 -19
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +54 -54
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/socket.d.ts +22 -0
- package/esm/commands/sync/socket.d.ts.map +1 -0
- package/esm/commands/sync/socket.js +69 -0
- package/esm/commands/sync/socket.js.map +1 -0
- package/esm/commands/sync/stat.d.ts +72 -72
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +116 -104
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +65 -60
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +123 -149
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/commands/tcpip.d.ts +5 -5
- package/esm/commands/tcpip.d.ts.map +1 -1
- package/esm/commands/tcpip.js +20 -18
- package/esm/commands/tcpip.js.map +1 -1
- package/esm/{auth.d.ts → daemon/auth.d.ts} +50 -51
- package/esm/daemon/auth.d.ts.map +1 -0
- package/esm/{auth.js → daemon/auth.js} +95 -96
- package/esm/daemon/auth.js.map +1 -0
- package/esm/daemon/connection.d.ts +11 -0
- package/esm/daemon/connection.d.ts.map +1 -0
- package/esm/daemon/connection.js +2 -0
- package/esm/daemon/connection.js.map +1 -0
- package/esm/{crypto.d.ts → daemon/crypto.d.ts} +36 -36
- package/esm/daemon/crypto.d.ts.map +1 -0
- package/esm/{crypto.js → daemon/crypto.js} +244 -248
- package/esm/daemon/crypto.js.map +1 -0
- package/esm/daemon/device.d.ts +9 -0
- package/esm/daemon/device.d.ts.map +1 -0
- package/esm/daemon/device.js +2 -0
- package/esm/daemon/device.js.map +1 -0
- package/esm/daemon/dispatcher.d.ts +42 -0
- package/esm/daemon/dispatcher.d.ts.map +1 -0
- package/esm/{socket → daemon}/dispatcher.js +225 -234
- package/esm/daemon/dispatcher.js.map +1 -0
- package/esm/daemon/index.d.ts +8 -0
- package/esm/daemon/index.d.ts.map +1 -0
- package/esm/daemon/index.js +8 -0
- package/esm/daemon/index.js.map +1 -0
- package/esm/{packet.d.ts → daemon/packet.d.ts} +45 -46
- package/esm/daemon/packet.d.ts.map +1 -0
- package/esm/{packet.js → daemon/packet.js} +43 -48
- package/esm/daemon/packet.js.map +1 -0
- package/esm/daemon/socket.d.ts +58 -0
- package/esm/daemon/socket.d.ts.map +1 -0
- package/esm/{socket → daemon}/socket.js +121 -118
- package/esm/daemon/socket.js.map +1 -0
- package/esm/daemon/transport.d.ts +45 -0
- package/esm/daemon/transport.d.ts.map +1 -0
- package/esm/daemon/transport.js +184 -0
- package/esm/daemon/transport.js.map +1 -0
- package/esm/features.d.ts +10 -7
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +13 -10
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +7 -9
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +7 -9
- package/esm/index.js.map +1 -1
- package/esm/server/client.d.ts +78 -0
- package/esm/server/client.d.ts.map +1 -0
- package/esm/server/client.js +329 -0
- package/esm/server/client.js.map +1 -0
- package/esm/server/index.d.ts +3 -0
- package/esm/server/index.d.ts.map +1 -0
- package/esm/server/index.js +3 -0
- package/esm/server/index.js.map +1 -0
- package/esm/server/transport.d.ts +19 -0
- package/esm/server/transport.d.ts.map +1 -0
- package/esm/server/transport.js +44 -0
- package/esm/server/transport.js.map +1 -0
- package/esm/utils/auto-reset-event.d.ts +8 -9
- package/esm/utils/auto-reset-event.d.ts.map +1 -1
- package/esm/utils/auto-reset-event.js +33 -33
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +27 -27
- package/esm/utils/base64.js +246 -246
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/conditional-variable.d.ts +8 -0
- package/esm/utils/conditional-variable.d.ts.map +1 -0
- package/esm/utils/conditional-variable.js +34 -0
- package/esm/utils/conditional-variable.js.map +1 -0
- package/esm/utils/hex.d.ts +3 -0
- package/esm/utils/hex.d.ts.map +1 -0
- package/esm/utils/hex.js +55 -0
- package/esm/utils/hex.js.map +1 -0
- package/esm/utils/index.d.ts +6 -3
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +6 -3
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/no-op.d.ts +7 -0
- package/esm/utils/no-op.d.ts.map +1 -0
- package/esm/utils/no-op.js +12 -0
- package/esm/utils/no-op.js.map +1 -0
- package/package.json +14 -12
- package/src/adb.ts +47 -248
- package/src/banner.ts +82 -0
- package/src/commands/base.ts +1 -1
- package/src/commands/framebuffer.ts +4 -4
- package/src/commands/index.ts +7 -8
- package/src/commands/power.ts +2 -2
- package/src/commands/reverse.ts +90 -70
- package/src/commands/subprocess/command.ts +12 -4
- package/src/commands/subprocess/index.ts +3 -3
- package/src/commands/subprocess/protocols/index.ts +3 -3
- package/src/commands/subprocess/protocols/none.ts +36 -23
- package/src/commands/subprocess/protocols/shell.ts +94 -74
- package/src/commands/subprocess/protocols/types.ts +7 -7
- package/src/commands/subprocess/utils.ts +1 -1
- package/src/commands/sync/index.ts +8 -7
- package/src/commands/sync/list.ts +44 -25
- package/src/commands/sync/pull.ts +40 -45
- package/src/commands/sync/push.ts +158 -39
- package/src/commands/sync/request.ts +21 -16
- package/src/commands/sync/response.ts +10 -9
- package/src/commands/sync/socket.ts +99 -0
- package/src/commands/sync/stat.ts +47 -42
- package/src/commands/sync/sync.ts +73 -116
- package/src/commands/tcpip.ts +9 -7
- package/src/{auth.ts → daemon/auth.ts} +24 -23
- package/src/{crypto.ts → daemon/crypto.ts} +25 -33
- package/src/daemon/device.ts +14 -0
- package/src/{socket → daemon}/dispatcher.ts +95 -117
- package/src/daemon/index.ts +7 -0
- package/src/daemon/packet.ts +75 -0
- package/src/{socket → daemon}/socket.ts +71 -56
- package/src/daemon/transport.ts +269 -0
- package/src/features.ts +9 -6
- package/src/index.ts +3 -5
- package/src/server/client.ts +476 -0
- package/src/server/index.ts +2 -0
- package/src/server/transport.ts +77 -0
- package/src/utils/auto-reset-event.ts +14 -15
- package/src/utils/conditional-variable.ts +45 -0
- package/src/utils/hex.ts +58 -0
- package/src/utils/index.ts +6 -3
- package/src/utils/no-op.ts +12 -0
- package/tsconfig.build.json +12 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/auth.d.ts.map +0 -1
- package/esm/auth.js.map +0 -1
- package/esm/backend.d.ts +0 -9
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -2
- package/esm/backend.js.map +0 -1
- package/esm/commands/install.d.ts +0 -4
- package/esm/commands/install.d.ts.map +0 -1
- package/esm/commands/install.js +0 -29
- package/esm/commands/install.js.map +0 -1
- package/esm/crypto.d.ts.map +0 -1
- package/esm/crypto.js.map +0 -1
- package/esm/packet.d.ts.map +0 -1
- package/esm/packet.js.map +0 -1
- package/esm/socket/dispatcher.d.ts +0 -60
- package/esm/socket/dispatcher.d.ts.map +0 -1
- package/esm/socket/dispatcher.js.map +0 -1
- package/esm/socket/index.d.ts +0 -3
- package/esm/socket/index.d.ts.map +0 -1
- package/esm/socket/index.js +0 -3
- package/esm/socket/index.js.map +0 -1
- package/esm/socket/socket.d.ts +0 -60
- package/esm/socket/socket.d.ts.map +0 -1
- package/esm/socket/socket.js.map +0 -1
- package/src/backend.ts +0 -14
- package/src/commands/install.ts +0 -40
- package/src/packet.ts +0 -90
- package/src/socket/index.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverse.js","sourceRoot":"","sources":["../../src/commands/reverse.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"reverse.js","sourceRoot":"","sources":["../../src/commands/reverse.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,MAAM,EAAE,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAU5D,MAAM,wBAAwB,GAAG,IAAI,MAAM,EAAE;KACxC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;KAC/B,MAAM,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;AAExE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACtC,Y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I,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC;QAC/C,IAAI,CAAC,4BAA4B,CAAC,KAAK,EAAE,CAAC;QAE1C,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;QAElD,oDAAoD;IACxD,CAAC;CACJ"}
|
|
@@ -1,52 +1,58 @@
|
|
|
1
|
-
import { AdbCommandBase } from "../base.js";
|
|
2
|
-
import {
|
|
3
|
-
export interface AdbSubprocessOptions {
|
|
4
|
-
/**
|
|
5
|
-
* A list of `AdbSubprocessProtocolConstructor`s to be used.
|
|
6
|
-
*
|
|
7
|
-
* Different `AdbSubprocessProtocol` has different capabilities, thus requires specific adaptations.
|
|
8
|
-
* Check their documentations for details.
|
|
9
|
-
*
|
|
10
|
-
* The first protocol whose `isSupported` returns `true` will be used.
|
|
11
|
-
* If no `AdbSubprocessProtocol` is supported, an error will be thrown.
|
|
12
|
-
*
|
|
13
|
-
* @default [AdbSubprocessShellProtocol, AdbSubprocessNoneProtocol]
|
|
14
|
-
*/
|
|
15
|
-
protocols: AdbSubprocessProtocolConstructor[];
|
|
16
|
-
}
|
|
17
|
-
export interface AdbSubprocessWaitResult {
|
|
18
|
-
stdout: string;
|
|
19
|
-
stderr: string;
|
|
20
|
-
exitCode: number;
|
|
21
|
-
}
|
|
22
|
-
export declare class AdbSubprocess extends AdbCommandBase {
|
|
23
|
-
private createProtocol;
|
|
24
|
-
/**
|
|
25
|
-
* Spawns an executable in PTY
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
* @param
|
|
41
|
-
* @
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
* @param
|
|
48
|
-
* @returns The entire output of the command
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
import { AdbCommandBase } from "../base.js";
|
|
2
|
+
import type { AdbSubprocessProtocol, AdbSubprocessProtocolConstructor } from "./protocols/index.js";
|
|
3
|
+
export interface AdbSubprocessOptions {
|
|
4
|
+
/**
|
|
5
|
+
* A list of `AdbSubprocessProtocolConstructor`s to be used.
|
|
6
|
+
*
|
|
7
|
+
* Different `AdbSubprocessProtocol` has different capabilities, thus requires specific adaptations.
|
|
8
|
+
* Check their documentations for details.
|
|
9
|
+
*
|
|
10
|
+
* The first protocol whose `isSupported` returns `true` will be used.
|
|
11
|
+
* If no `AdbSubprocessProtocol` is supported, an error will be thrown.
|
|
12
|
+
*
|
|
13
|
+
* @default [AdbSubprocessShellProtocol, AdbSubprocessNoneProtocol]
|
|
14
|
+
*/
|
|
15
|
+
protocols: AdbSubprocessProtocolConstructor[];
|
|
16
|
+
}
|
|
17
|
+
export interface AdbSubprocessWaitResult {
|
|
18
|
+
stdout: string;
|
|
19
|
+
stderr: string;
|
|
20
|
+
exitCode: number;
|
|
21
|
+
}
|
|
22
|
+
export declare class AdbSubprocess extends AdbCommandBase {
|
|
23
|
+
private createProtocol;
|
|
24
|
+
/**
|
|
25
|
+
* Spawns an executable in PTY mode.
|
|
26
|
+
*
|
|
27
|
+
* Redirection mode is enough for most simple commands, but PTY mode is required for
|
|
28
|
+
* commands that manipulate the terminal, such as `vi` and `less`.
|
|
29
|
+
* @param command The command to run. If omitted, the default shell will be spawned.
|
|
30
|
+
* @param options The options for creating the `AdbSubprocessProtocol`
|
|
31
|
+
* @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
|
|
32
|
+
*/
|
|
33
|
+
shell(command?: string | string[], options?: Partial<AdbSubprocessOptions>): Promise<AdbSubprocessProtocol>;
|
|
34
|
+
/**
|
|
35
|
+
* Spawns an executable and redirect the standard input/output stream.
|
|
36
|
+
*
|
|
37
|
+
* Redirection mode is enough for most simple commands, but PTY mode is required for
|
|
38
|
+
* commands that manipulate the terminal, such as `vi` and `less`.
|
|
39
|
+
* @param command The command to run, or an array of strings containing both command and args.
|
|
40
|
+
* @param options The options for creating the `AdbSubprocessProtocol`
|
|
41
|
+
* @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
|
|
42
|
+
*/
|
|
43
|
+
spawn(command: string | string[], options?: Partial<AdbSubprocessOptions>): Promise<AdbSubprocessProtocol>;
|
|
44
|
+
/**
|
|
45
|
+
* Spawns a new process, waits until it exits, and returns the entire output.
|
|
46
|
+
* @param command The command to run
|
|
47
|
+
* @param options The options for creating the `AdbSubprocessProtocol`
|
|
48
|
+
* @returns The entire output of the command
|
|
49
|
+
*/
|
|
50
|
+
spawnAndWait(command: string | string[], options?: Partial<AdbSubprocessOptions>): Promise<AdbSubprocessWaitResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Spawns a new process, waits until it exits, and returns the entire output.
|
|
53
|
+
* @param command The command to run
|
|
54
|
+
* @returns The entire output of the command
|
|
55
|
+
*/
|
|
56
|
+
spawnAndWaitLegacy(command: string | string[]): Promise<string>;
|
|
57
|
+
}
|
|
52
58
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EACR,qBAAqB,EACrB,gCAAgC,EACnC,MAAM,sBAAsB,CAAC;AAM9B,MAAM,WAAW,oBAAoB;IACjC;;;;;;;;;;OAUG;IACH,SAAS,EAAE,gCAAgC,EAAE,CAAC;CACjD;AAMD,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAc,SAAQ,cAAc;YAC/B,cAAc;IA6B5B;;;;;;;;OAQG;IACI,KAAK,CACR,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACxC,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;;;;;;OAQG;IACI,KAAK,CACR,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACxC,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;;;OAKG;IACU,YAAY,CACrB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACxC,OAAO,CAAC,uBAAuB,CAAC;IAmBnC;;;;OAIG;IACU,kBAAkB,CAC3B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAC3B,OAAO,CAAC,MAAM,CAAC;CAMrB"}
|
|
@@ -1,81 +1,87 @@
|
|
|
1
|
-
import { DecodeUtf8Stream, GatherStringStream } from "@yume-chan/stream-extra";
|
|
2
|
-
import { AdbCommandBase } from "../base.js";
|
|
3
|
-
import { AdbSubprocessNoneProtocol, AdbSubprocessShellProtocol, } from "./protocols/index.js";
|
|
4
|
-
const DEFAULT_OPTIONS = {
|
|
5
|
-
protocols: [AdbSubprocessShellProtocol, AdbSubprocessNoneProtocol],
|
|
6
|
-
};
|
|
7
|
-
export class AdbSubprocess extends AdbCommandBase {
|
|
8
|
-
async createProtocol(mode, command, options) {
|
|
9
|
-
const { protocols } = { ...DEFAULT_OPTIONS, ...options };
|
|
10
|
-
let Constructor;
|
|
11
|
-
for (const item of protocols) {
|
|
12
|
-
// It's async so can't use `Array#find`
|
|
13
|
-
if (await item.isSupported(this.adb)) {
|
|
14
|
-
Constructor = item;
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (!Constructor) {
|
|
19
|
-
throw new Error("No specified protocol is supported by the device");
|
|
20
|
-
}
|
|
21
|
-
if (Array.isArray(command)) {
|
|
22
|
-
command = command.join(" ");
|
|
23
|
-
}
|
|
24
|
-
else if (command === undefined) {
|
|
25
|
-
// spawn the default shell
|
|
26
|
-
command = "";
|
|
27
|
-
}
|
|
28
|
-
return await Constructor[mode](this.adb, command);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Spawns an executable in PTY
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
import { DecodeUtf8Stream, GatherStringStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import { AdbCommandBase } from "../base.js";
|
|
3
|
+
import { AdbSubprocessNoneProtocol, AdbSubprocessShellProtocol, } from "./protocols/index.js";
|
|
4
|
+
const DEFAULT_OPTIONS = {
|
|
5
|
+
protocols: [AdbSubprocessShellProtocol, AdbSubprocessNoneProtocol],
|
|
6
|
+
};
|
|
7
|
+
export class AdbSubprocess extends AdbCommandBase {
|
|
8
|
+
async createProtocol(mode, command, options) {
|
|
9
|
+
const { protocols } = { ...DEFAULT_OPTIONS, ...options };
|
|
10
|
+
let Constructor;
|
|
11
|
+
for (const item of protocols) {
|
|
12
|
+
// It's async so can't use `Array#find`
|
|
13
|
+
if (await item.isSupported(this.adb)) {
|
|
14
|
+
Constructor = item;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (!Constructor) {
|
|
19
|
+
throw new Error("No specified protocol is supported by the device");
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(command)) {
|
|
22
|
+
command = command.join(" ");
|
|
23
|
+
}
|
|
24
|
+
else if (command === undefined) {
|
|
25
|
+
// spawn the default shell
|
|
26
|
+
command = "";
|
|
27
|
+
}
|
|
28
|
+
return await Constructor[mode](this.adb, command);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Spawns an executable in PTY mode.
|
|
32
|
+
*
|
|
33
|
+
* Redirection mode is enough for most simple commands, but PTY mode is required for
|
|
34
|
+
* commands that manipulate the terminal, such as `vi` and `less`.
|
|
35
|
+
* @param command The command to run. If omitted, the default shell will be spawned.
|
|
36
|
+
* @param options The options for creating the `AdbSubprocessProtocol`
|
|
37
|
+
* @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
|
|
38
|
+
*/
|
|
39
|
+
shell(command, options) {
|
|
40
|
+
return this.createProtocol("pty", command, options);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Spawns an executable and redirect the standard input/output stream.
|
|
44
|
+
*
|
|
45
|
+
* Redirection mode is enough for most simple commands, but PTY mode is required for
|
|
46
|
+
* commands that manipulate the terminal, such as `vi` and `less`.
|
|
47
|
+
* @param command The command to run, or an array of strings containing both command and args.
|
|
48
|
+
* @param options The options for creating the `AdbSubprocessProtocol`
|
|
49
|
+
* @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
|
|
50
|
+
*/
|
|
51
|
+
spawn(command, options) {
|
|
52
|
+
return this.createProtocol("raw", command, options);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Spawns a new process, waits until it exits, and returns the entire output.
|
|
56
|
+
* @param command The command to run
|
|
57
|
+
* @param options The options for creating the `AdbSubprocessProtocol`
|
|
58
|
+
* @returns The entire output of the command
|
|
59
|
+
*/
|
|
60
|
+
async spawnAndWait(command, options) {
|
|
61
|
+
const shell = await this.spawn(command, options);
|
|
62
|
+
const stdout = new GatherStringStream();
|
|
63
|
+
const stderr = new GatherStringStream();
|
|
64
|
+
const [, , exitCode] = await Promise.all([
|
|
65
|
+
shell.stdout.pipeThrough(new DecodeUtf8Stream()).pipeTo(stdout),
|
|
66
|
+
shell.stderr.pipeThrough(new DecodeUtf8Stream()).pipeTo(stderr),
|
|
67
|
+
shell.exit,
|
|
68
|
+
]);
|
|
69
|
+
return {
|
|
70
|
+
stdout: stdout.result,
|
|
71
|
+
stderr: stderr.result,
|
|
72
|
+
exitCode,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Spawns a new process, waits until it exits, and returns the entire output.
|
|
77
|
+
* @param command The command to run
|
|
78
|
+
* @returns The entire output of the command
|
|
79
|
+
*/
|
|
80
|
+
async spawnAndWaitLegacy(command) {
|
|
81
|
+
const { stdout } = await this.spawnAndWait(command, {
|
|
82
|
+
protocols: [AdbSubprocessNoneProtocol],
|
|
83
|
+
});
|
|
84
|
+
return stdout;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
81
87
|
//# sourceMappingURL=command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/commands/subprocess/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,C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
|
|
1
|
+
export * from "./command.js";
|
|
2
|
+
export * from "./protocols/index.js";
|
|
3
|
+
export * from "./utils.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./command.js";
|
|
2
|
+
export * from "./protocols/index.js";
|
|
3
|
+
export * from "./utils.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./none.js";
|
|
2
|
+
export * from "./shell.js";
|
|
3
|
+
export * from "./types.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from "./none.js";
|
|
2
|
+
export * from "./shell.js";
|
|
3
|
+
export * from "./types.js";
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
import { ReadableStream } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* * `
|
|
10
|
-
* * `
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static isSupported(): boolean;
|
|
15
|
-
static pty(adb: Adb, command: string): Promise<AdbSubprocessNoneProtocol>;
|
|
16
|
-
static raw(adb: Adb, command: string): Promise<AdbSubprocessNoneProtocol>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
get exit(): Promise<number>;
|
|
32
|
-
constructor(socket: AdbSocket);
|
|
33
|
-
resize(): void;
|
|
34
|
-
kill(): Promise<void>;
|
|
35
|
-
}
|
|
1
|
+
import { ReadableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import type { Adb, AdbSocket } from "../../../adb.js";
|
|
3
|
+
import type { AdbSubprocessProtocol } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* The legacy shell
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* * `stderr`: No
|
|
9
|
+
* * `exit` exit code: No
|
|
10
|
+
* * `resize`: No
|
|
11
|
+
*/
|
|
12
|
+
export declare class AdbSubprocessNoneProtocol implements AdbSubprocessProtocol {
|
|
13
|
+
#private;
|
|
14
|
+
static isSupported(): boolean;
|
|
15
|
+
static pty(adb: Adb, command: string): Promise<AdbSubprocessNoneProtocol>;
|
|
16
|
+
static raw(adb: Adb, command: string): Promise<AdbSubprocessNoneProtocol>;
|
|
17
|
+
get stdin(): import("web-streams-polyfill").WritableStream<import("@yume-chan/stream-extra").Consumable<Uint8Array>>;
|
|
18
|
+
/**
|
|
19
|
+
* Legacy shell mixes stdout and stderr.
|
|
20
|
+
*/
|
|
21
|
+
get stdout(): ReadableStream<Uint8Array>;
|
|
22
|
+
/**
|
|
23
|
+
* `stderr` will always be empty.
|
|
24
|
+
*/
|
|
25
|
+
get stderr(): ReadableStream<Uint8Array>;
|
|
26
|
+
get exit(): Promise<number>;
|
|
27
|
+
constructor(socket: AdbSocket);
|
|
28
|
+
resize(): void;
|
|
29
|
+
kill(): Promise<void>;
|
|
30
|
+
}
|
|
36
31
|
//# sourceMappingURL=none.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/none.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,
|
|
1
|
+
{"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/none.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;GAOG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB;;WACrD,WAAW;WAIL,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;WAM7B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;IAajD,IAAW,KAAK,4GAEf;IAGD;;OAEG;IACH,IAAW,MAAM,+BAEhB;IAGD;;OAEG;IACH,IAAW,MAAM,+BAEhB;IAGD,IAAW,IAAI,oBAEd;gBAEkB,MAAM,EAAE,SAAS;IAgB7B,MAAM;IAIN,IAAI;CAGd"}
|
|
@@ -1,56 +1,66 @@
|
|
|
1
|
-
import { DuplexStreamFactory, ReadableStream } from
|
|
2
|
-
/**
|
|
3
|
-
* The legacy shell
|
|
4
|
-
*
|
|
5
|
-
* Features:
|
|
6
|
-
* * `stderr`: No
|
|
7
|
-
* * `exit` exit code: No
|
|
8
|
-
* * `resize`: No
|
|
9
|
-
*/
|
|
10
|
-
export class AdbSubprocessNoneProtocol {
|
|
11
|
-
static isSupported() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
import { DuplexStreamFactory, ReadableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
/**
|
|
3
|
+
* The legacy shell
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* * `stderr`: No
|
|
7
|
+
* * `exit` exit code: No
|
|
8
|
+
* * `resize`: No
|
|
9
|
+
*/
|
|
10
|
+
export class AdbSubprocessNoneProtocol {
|
|
11
|
+
static isSupported() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
static async pty(adb, command) {
|
|
15
|
+
return new AdbSubprocessNoneProtocol(await adb.createSocket(`shell:${command}`));
|
|
16
|
+
}
|
|
17
|
+
static async raw(adb, command) {
|
|
18
|
+
// `shell,raw:${command}` also triggers raw mode,
|
|
19
|
+
// But is not supported on Android version <7.
|
|
20
|
+
return new AdbSubprocessNoneProtocol(await adb.createSocket(`exec:${command}`));
|
|
21
|
+
}
|
|
22
|
+
#socket;
|
|
23
|
+
#duplex;
|
|
24
|
+
// Legacy shell forwards all data to stdin.
|
|
25
|
+
get stdin() {
|
|
26
|
+
return this.#socket.writable;
|
|
27
|
+
}
|
|
28
|
+
#stdout;
|
|
29
|
+
/**
|
|
30
|
+
* Legacy shell mixes stdout and stderr.
|
|
31
|
+
*/
|
|
32
|
+
get stdout() {
|
|
33
|
+
return this.#stdout;
|
|
34
|
+
}
|
|
35
|
+
#stderr;
|
|
36
|
+
/**
|
|
37
|
+
* `stderr` will always be empty.
|
|
38
|
+
*/
|
|
39
|
+
get stderr() {
|
|
40
|
+
return this.#stderr;
|
|
41
|
+
}
|
|
42
|
+
#exit;
|
|
43
|
+
get exit() {
|
|
44
|
+
return this.#exit;
|
|
45
|
+
}
|
|
46
|
+
constructor(socket) {
|
|
47
|
+
this.#socket = socket;
|
|
48
|
+
// Link `stdout`, `stderr` and `stdin` together,
|
|
49
|
+
// so closing any of them will close the others.
|
|
50
|
+
this.#duplex = new DuplexStreamFactory({
|
|
51
|
+
close: async () => {
|
|
52
|
+
await this.#socket.close();
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
this.#stdout = this.#duplex.wrapReadable(this.#socket.readable);
|
|
56
|
+
this.#stderr = this.#duplex.wrapReadable(new ReadableStream());
|
|
57
|
+
this.#exit = this.#duplex.closed.then(() => 0);
|
|
58
|
+
}
|
|
59
|
+
resize() {
|
|
60
|
+
// Not supported, but don't throw.
|
|
61
|
+
}
|
|
62
|
+
kill() {
|
|
63
|
+
return this.#duplex.close();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
56
66
|
//# sourceMappingURL=none.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"none.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/none.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"none.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/none.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAM9E;;;;;;;GAOG;AACH,MAAM,OAAO,yBAAyB;IAC3B,MAAM,CAAC,WAAW;QACrB,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAQ,EAAE,OAAe;QAC7C,OAAO,IAAI,yBAAyB,CAChC,MAAM,GAAG,CAAC,YAAY,CAAC,SAAS,OAAO,EAAE,CAAC,CAC7C,CAAC;IACN,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,GAAQ,EAAE,OAAe;QAC7C,iDAAiD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