@yume-chan/adb 0.0.12 → 0.0.15

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.
Files changed (145) hide show
  1. package/CHANGELOG.json +54 -0
  2. package/CHANGELOG.md +28 -1
  3. package/README.md +24 -17
  4. package/esm/adb.d.ts +10 -9
  5. package/esm/adb.d.ts.map +1 -1
  6. package/esm/adb.js +88 -67
  7. package/esm/adb.js.map +1 -1
  8. package/esm/auth.d.ts +6 -6
  9. package/esm/auth.d.ts.map +1 -1
  10. package/esm/auth.js +8 -6
  11. package/esm/auth.js.map +1 -1
  12. package/esm/backend.d.ts +2 -2
  13. package/esm/commands/install.d.ts.map +1 -1
  14. package/esm/commands/install.js +5 -7
  15. package/esm/commands/install.js.map +1 -1
  16. package/esm/commands/reverse.d.ts +9 -12
  17. package/esm/commands/reverse.d.ts.map +1 -1
  18. package/esm/commands/reverse.js +44 -36
  19. package/esm/commands/reverse.js.map +1 -1
  20. package/esm/commands/subprocess/index.d.ts +19 -20
  21. package/esm/commands/subprocess/index.d.ts.map +1 -1
  22. package/esm/commands/subprocess/index.js +36 -31
  23. package/esm/commands/subprocess/index.js.map +1 -1
  24. package/esm/commands/subprocess/legacy.d.ts +14 -7
  25. package/esm/commands/subprocess/legacy.d.ts.map +1 -1
  26. package/esm/commands/subprocess/legacy.js +14 -5
  27. package/esm/commands/subprocess/legacy.js.map +1 -1
  28. package/esm/commands/subprocess/protocol.d.ts +3 -2
  29. package/esm/commands/subprocess/protocol.d.ts.map +1 -1
  30. package/esm/commands/subprocess/protocol.js +6 -4
  31. package/esm/commands/subprocess/protocol.js.map +1 -1
  32. package/esm/commands/subprocess/protocols/index.d.ts +4 -0
  33. package/esm/commands/subprocess/protocols/index.d.ts.map +1 -0
  34. package/esm/commands/subprocess/protocols/index.js +4 -0
  35. package/esm/commands/subprocess/protocols/index.js.map +1 -0
  36. package/esm/commands/subprocess/protocols/none.d.ts +35 -0
  37. package/esm/commands/subprocess/protocols/none.d.ts.map +1 -0
  38. package/esm/commands/subprocess/protocols/none.js +53 -0
  39. package/esm/commands/subprocess/protocols/none.js.map +1 -0
  40. package/esm/commands/subprocess/protocols/shell.d.ts +39 -0
  41. package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -0
  42. package/esm/commands/subprocess/protocols/shell.js +155 -0
  43. package/esm/commands/subprocess/protocols/shell.js.map +1 -0
  44. package/esm/commands/subprocess/protocols/types.d.ts +50 -0
  45. package/esm/commands/subprocess/protocols/types.d.ts.map +1 -0
  46. package/esm/commands/subprocess/protocols/types.js +2 -0
  47. package/esm/commands/subprocess/protocols/types.js.map +1 -0
  48. package/esm/commands/subprocess/types.d.ts +9 -6
  49. package/esm/commands/subprocess/types.d.ts.map +1 -1
  50. package/esm/commands/sync/list.d.ts +25 -1
  51. package/esm/commands/sync/list.d.ts.map +1 -1
  52. package/esm/commands/sync/list.js +40 -5
  53. package/esm/commands/sync/list.js.map +1 -1
  54. package/esm/commands/sync/pull.d.ts.map +1 -1
  55. package/esm/commands/sync/pull.js +6 -3
  56. package/esm/commands/sync/pull.js.map +1 -1
  57. package/esm/commands/sync/request.d.ts +1 -0
  58. package/esm/commands/sync/request.d.ts.map +1 -1
  59. package/esm/commands/sync/request.js +1 -0
  60. package/esm/commands/sync/request.js.map +1 -1
  61. package/esm/commands/sync/response.d.ts +2 -1
  62. package/esm/commands/sync/response.d.ts.map +1 -1
  63. package/esm/commands/sync/response.js +2 -1
  64. package/esm/commands/sync/response.js.map +1 -1
  65. package/esm/commands/sync/stat.d.ts +13 -1
  66. package/esm/commands/sync/stat.d.ts.map +1 -1
  67. package/esm/commands/sync/stat.js +22 -9
  68. package/esm/commands/sync/stat.js.map +1 -1
  69. package/esm/commands/sync/sync.d.ts +13 -35
  70. package/esm/commands/sync/sync.d.ts.map +1 -1
  71. package/esm/commands/sync/sync.js +40 -10
  72. package/esm/commands/sync/sync.js.map +1 -1
  73. package/esm/crypto.d.ts +23 -10
  74. package/esm/crypto.d.ts.map +1 -1
  75. package/esm/crypto.js +64 -46
  76. package/esm/crypto.js.map +1 -1
  77. package/esm/features.d.ts +4 -2
  78. package/esm/features.d.ts.map +1 -1
  79. package/esm/features.js +6 -2
  80. package/esm/features.js.map +1 -1
  81. package/esm/packet.d.ts +21 -2
  82. package/esm/packet.d.ts.map +1 -1
  83. package/esm/packet.js +2 -2
  84. package/esm/packet.js.map +1 -1
  85. package/esm/socket/dispatcher.d.ts +35 -23
  86. package/esm/socket/dispatcher.d.ts.map +1 -1
  87. package/esm/socket/dispatcher.js +97 -72
  88. package/esm/socket/dispatcher.js.map +1 -1
  89. package/esm/socket/socket.d.ts +29 -8
  90. package/esm/socket/socket.d.ts.map +1 -1
  91. package/esm/socket/socket.js +43 -29
  92. package/esm/socket/socket.js.map +1 -1
  93. package/esm/stream/buffered.d.ts +1 -1
  94. package/esm/stream/buffered.d.ts.map +1 -1
  95. package/esm/stream/buffered.js +2 -2
  96. package/esm/stream/buffered.js.map +1 -1
  97. package/esm/stream/detect.d.ts +1 -17
  98. package/esm/stream/detect.d.ts.map +1 -1
  99. package/esm/stream/detect.js +4 -5
  100. package/esm/stream/detect.js.map +1 -1
  101. package/esm/stream/detect.polyfill.d.ts +1 -1
  102. package/esm/stream/detect.polyfill.d.ts.map +1 -1
  103. package/esm/stream/detect.polyfill.js +4 -1
  104. package/esm/stream/detect.polyfill.js.map +1 -1
  105. package/esm/stream/transform.d.ts +39 -33
  106. package/esm/stream/transform.d.ts.map +1 -1
  107. package/esm/stream/transform.js +121 -100
  108. package/esm/stream/transform.js.map +1 -1
  109. package/esm/utils/base64.js +5 -5
  110. package/esm/utils/base64.js.map +1 -1
  111. package/esm/utils/encoding.d.ts.map +1 -1
  112. package/esm/utils/encoding.js.map +1 -1
  113. package/esm/utils/index.d.ts +1 -1
  114. package/esm/utils/index.d.ts.map +1 -1
  115. package/esm/utils/index.js +1 -1
  116. package/esm/utils/index.js.map +1 -1
  117. package/package.json +7 -7
  118. package/src/adb.ts +112 -86
  119. package/src/auth.ts +21 -18
  120. package/src/backend.ts +2 -2
  121. package/src/commands/install.ts +7 -9
  122. package/src/commands/reverse.ts +48 -44
  123. package/src/commands/subprocess/index.ts +57 -42
  124. package/src/commands/subprocess/protocols/index.ts +3 -0
  125. package/src/commands/subprocess/{legacy.ts → protocols/none.ts} +20 -10
  126. package/src/commands/subprocess/{protocol.ts → protocols/shell.ts} +22 -17
  127. package/src/commands/subprocess/{types.ts → protocols/types.ts} +13 -9
  128. package/src/commands/sync/list.ts +51 -5
  129. package/src/commands/sync/pull.ts +6 -3
  130. package/src/commands/sync/request.ts +1 -0
  131. package/src/commands/sync/response.ts +8 -2
  132. package/src/commands/sync/stat.ts +36 -9
  133. package/src/commands/sync/sync.ts +56 -20
  134. package/src/crypto.ts +72 -56
  135. package/src/features.ts +6 -2
  136. package/src/packet.ts +17 -6
  137. package/src/socket/dispatcher.ts +139 -91
  138. package/src/socket/socket.ts +76 -61
  139. package/src/stream/buffered.ts +2 -2
  140. package/src/stream/detect.polyfill.ts +5 -2
  141. package/src/stream/detect.ts +4 -24
  142. package/src/stream/transform.ts +144 -124
  143. package/src/utils/index.ts +1 -1
  144. package/tsconfig.build.tsbuildinfo +1 -1
  145. package/src/utils/encoding.ts +0 -13
@@ -2,17 +2,15 @@ import { WrapWritableStream } from "../stream/index.js";
2
2
  import { escapeArg } from "./subprocess/index.js";
3
3
  export function install(adb) {
4
4
  const filename = `/data/local/tmp/${Math.random().toString().substring(2)}.apk`;
5
+ let sync;
5
6
  return new WrapWritableStream({
6
7
  async start() {
8
+ // TODO: install: support other install apk methods (streaming, etc.)
7
9
  // Upload apk file to tmp folder
8
- const sync = await adb.sync();
9
- const writable = sync.write(filename, undefined, undefined);
10
- return {
11
- writable,
12
- state: sync,
13
- };
10
+ sync = await adb.sync();
11
+ return sync.write(filename, undefined, undefined);
14
12
  },
15
- async close(sync) {
13
+ async close() {
16
14
  sync.dispose();
17
15
  // Invoke `pm install` to install it
18
16
  await adb.subprocess.spawnAndWaitLegacy(['pm', 'install', escapeArg(filename)]);
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAkB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,MAAM,UAAU,OAAO,CACnB,GAAQ;IAER,MAAM,QAAQ,GAAG,mBAAmB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhF,OAAO,IAAI,kBAAkB,CAAkD;QAC3E,KAAK,CAAC,KAAK;YACP,gCAAgC;YAChC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;YAE5D,OAAO;gBACH,QAAQ;gBACR,KAAK,EAAE,IAAI;aACd,CAAC;QACN,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,IAAI;YACZ,IAAI,CAAC,OAAO,EAAE,CAAC;YAEf,oCAAoC;YACpC,MAAM,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAEhF,uBAAuB;YACvB,MAAM,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAkB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,MAAM,UAAU,OAAO,CACnB,GAAQ;IAER,MAAM,QAAQ,GAAG,mBAAmB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAEhF,IAAI,IAAc,CAAC;IACnB,OAAO,IAAI,kBAAkB,CAAa;QACtC,KAAK,CAAC,KAAK;YACP,qEAAqE;YAErE,gCAAgC;YAChC,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACtD,CAAC;QACD,KAAK,CAAC,KAAK;YACP,IAAI,CAAC,OAAO,EAAE,CAAC;YAEf,oCAAoC;YACpC,MAAM,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAEhF,uBAAuB;YACvB,MAAM,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
@@ -1,31 +1,28 @@
1
1
  import { AutoDisposable } from '@yume-chan/event';
2
- import type { AdbPacketCore } from '../packet.js';
3
- import type { AdbIncomingSocketEventArgs, AdbPacketDispatcher, AdbSocket } from '../socket/index.js';
4
- export interface AdbReverseHandler {
5
- onSocket(packet: AdbPacketCore, socket: AdbSocket): void;
6
- }
2
+ import type { Adb } from "../adb.js";
3
+ import type { AdbIncomingSocketHandler, AdbSocket } from '../socket/index.js';
7
4
  export interface AdbForwardListener {
8
5
  deviceSerial: string;
9
6
  localName: string;
10
7
  remoteName: string;
11
8
  }
12
9
  export declare class AdbReverseCommand extends AutoDisposable {
13
- protected localPortToHandler: Map<number, AdbReverseHandler>;
14
- protected deviceAddressToLocalPort: Map<string, number>;
15
- protected dispatcher: AdbPacketDispatcher;
10
+ protected localAddressToHandler: Map<string, AdbIncomingSocketHandler>;
11
+ protected deviceAddressToLocalAddress: Map<string, string>;
12
+ protected adb: Adb;
16
13
  protected listening: boolean;
17
- constructor(dispatcher: AdbPacketDispatcher);
18
- protected handleIncomingSocket(e: AdbIncomingSocketEventArgs): void;
14
+ constructor(adb: Adb);
15
+ protected handleIncomingSocket: (socket: AdbSocket) => Promise<boolean>;
19
16
  private createBufferedStream;
20
17
  private sendRequest;
21
18
  list(): Promise<AdbForwardListener[]>;
22
19
  /**
23
20
  * @param deviceAddress The address adbd on device is listening on. Can be `tcp:0` to let adbd choose an available TCP port by itself.
24
- * @param localPort Native ADB will open a connection to localPort when reverse connection starts. In webadb, it's only used to uniquely identify a reverse registry, `handler` will be called on connection.
21
+ * @param localAddress Native ADB client will open a connection to this address when reverse connection received. In WebADB, it's only used to uniquely identify a reverse tunnel registry, `handler` will be called to handle the connection.
25
22
  * @param handler A callback to handle incoming connections
26
23
  * @returns If `deviceAddress` is `tcp:0`, return `tcp:{ACTUAL_LISTENING_PORT}`; otherwise, return `deviceAddress`.
27
24
  */
28
- add(deviceAddress: string, localPort: number, handler: AdbReverseHandler): Promise<string>;
25
+ add(deviceAddress: string, localAddress: string, handler: AdbIncomingSocketHandler): Promise<string>;
29
26
  remove(deviceAddress: string): Promise<void>;
30
27
  removeAll(): Promise<void>;
31
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../src/commands/reverse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAIrG,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;CAC5D;AAED,MAAM,WAAW,kBAAkB;IAC/B,YAAY,EAAE,MAAM,CAAC;IAErB,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GAAG,EAAE,GAAG;IAO3B,SAAS,CAAC,oBAAoB,WAAkB,SAAS,sBAKvD;YAEY,oBAAoB;YAKpB,WAAW;IASZ,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAYlD;;;;;OAKG;IACU,GAAG,CACZ,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,MAAM,CAAC;IAgCL,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5C,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ1C"}
@@ -1,40 +1,34 @@
1
1
  // cspell: ignore killforward
2
2
  import { AutoDisposable } from '@yume-chan/event';
3
3
  import Struct from '@yume-chan/struct';
4
- import { AdbBufferedStream } from '../stream/index.js';
4
+ import { AdbBufferedStream, BufferedStreamEndedError } from '../stream/index.js';
5
5
  import { decodeUtf8 } from "../utils/index.js";
6
- const AdbReverseStringResponse = new Struct({ littleEndian: true })
6
+ const AdbReverseStringResponse = new Struct()
7
7
  .string('length', { length: 4 })
8
- .string('content', { lengthField: 'length', lengthFieldBase: 16 });
9
- const AdbReverseErrorResponse = new Struct({ littleEndian: true })
8
+ .string('content', { lengthField: 'length', lengthFieldRadix: 16 });
9
+ const AdbReverseErrorResponse = new Struct()
10
10
  .fields(AdbReverseStringResponse)
11
11
  .postDeserialize((value) => {
12
12
  throw new Error(value.content);
13
13
  });
14
14
  export class AdbReverseCommand extends AutoDisposable {
15
- localPortToHandler = new Map();
16
- deviceAddressToLocalPort = new Map();
17
- dispatcher;
15
+ localAddressToHandler = new Map();
16
+ deviceAddressToLocalAddress = new Map();
17
+ adb;
18
18
  listening = false;
19
- constructor(dispatcher) {
19
+ constructor(adb) {
20
20
  super();
21
- this.dispatcher = dispatcher;
22
- this.addDisposable(this.dispatcher.onIncomingSocket(this.handleIncomingSocket, this));
23
- }
24
- handleIncomingSocket(e) {
25
- if (e.handled) {
26
- return;
27
- }
28
- const address = decodeUtf8(e.packet.payload);
29
- // Address format: `tcp:12345\0`
30
- const port = Number.parseInt(address.substring(4));
31
- if (this.localPortToHandler.has(port)) {
32
- this.localPortToHandler.get(port).onSocket(e.packet, e.socket);
33
- e.handled = true;
34
- }
21
+ this.adb = adb;
22
+ this.addDisposable(this.adb.addIncomingSocketHandler(this.handleIncomingSocket));
35
23
  }
24
+ handleIncomingSocket = async (socket) => {
25
+ let address = socket.serviceString;
26
+ // ADB daemon appends `\0` to the service string
27
+ address = address.replace(/\0/g, '');
28
+ return !!(await this.localAddressToHandler.get(address)?.(socket));
29
+ };
36
30
  async createBufferedStream(service) {
37
- const socket = await this.dispatcher.createSocket(service);
31
+ const socket = await this.adb.createSocket(service);
38
32
  return new AdbBufferedStream(socket);
39
33
  }
40
34
  async sendRequest(service) {
@@ -56,35 +50,49 @@ export class AdbReverseCommand extends AutoDisposable {
56
50
  }
57
51
  /**
58
52
  * @param deviceAddress The address adbd on device is listening on. Can be `tcp:0` to let adbd choose an available TCP port by itself.
59
- * @param localPort Native ADB will open a connection to localPort when reverse connection starts. In webadb, it's only used to uniquely identify a reverse registry, `handler` will be called on connection.
53
+ * @param localAddress Native ADB client will open a connection to this address when reverse connection received. In WebADB, it's only used to uniquely identify a reverse tunnel registry, `handler` will be called to handle the connection.
60
54
  * @param handler A callback to handle incoming connections
61
55
  * @returns If `deviceAddress` is `tcp:0`, return `tcp:{ACTUAL_LISTENING_PORT}`; otherwise, return `deviceAddress`.
62
56
  */
63
- async add(deviceAddress, localPort, handler) {
64
- const stream = await this.sendRequest(`reverse:forward:${deviceAddress};tcp:${localPort}`);
57
+ async add(deviceAddress, localAddress, handler) {
58
+ const stream = await this.sendRequest(`reverse:forward:${deviceAddress};${localAddress}`);
65
59
  // `tcp:0` tells the device to pick an available port.
66
- // However, device will response with the selected port for all `tcp:` requests.
60
+ // Begin with Android 8, device will respond with the selected port for all `tcp:` requests.
67
61
  if (deviceAddress.startsWith('tcp:')) {
68
- const response = await AdbReverseStringResponse.deserialize(stream);
69
- deviceAddress = `tcp:${Number.parseInt(response.content, 10)}`;
62
+ let length;
63
+ try {
64
+ length = Number.parseInt(decodeUtf8(await stream.read(4)), 16);
65
+ }
66
+ catch (e) {
67
+ if (!(e instanceof BufferedStreamEndedError)) {
68
+ throw e;
69
+ }
70
+ // Device before Android 8 doesn't have this response.
71
+ // (the stream is closed now)
72
+ // Can be safely ignored.
73
+ }
74
+ if (length !== undefined) {
75
+ const port = decodeUtf8(await stream.read(length));
76
+ deviceAddress = `tcp:${Number.parseInt(port, 10)}`;
77
+ }
70
78
  }
71
- this.localPortToHandler.set(localPort, handler);
72
- this.deviceAddressToLocalPort.set(deviceAddress, localPort);
79
+ this.localAddressToHandler.set(localAddress, handler);
80
+ this.deviceAddressToLocalAddress.set(deviceAddress, localAddress);
73
81
  return deviceAddress;
74
82
  // No need to close the stream, device will close it
75
83
  }
76
84
  async remove(deviceAddress) {
77
85
  await this.sendRequest(`reverse:killforward:${deviceAddress}`);
78
- if (this.deviceAddressToLocalPort.has(deviceAddress)) {
79
- this.localPortToHandler.delete(this.deviceAddressToLocalPort.get(deviceAddress));
80
- this.deviceAddressToLocalPort.delete(deviceAddress);
86
+ if (this.deviceAddressToLocalAddress.has(deviceAddress)) {
87
+ this.localAddressToHandler.delete(this.deviceAddressToLocalAddress.get(deviceAddress));
88
+ this.deviceAddressToLocalAddress.delete(deviceAddress);
81
89
  }
82
90
  // No need to close the stream, device will close it
83
91
  }
84
92
  async removeAll() {
85
93
  await this.sendRequest(`reverse:killforward-all`);
86
- this.deviceAddressToLocalPort.clear();
87
- this.localPortToHandler.clear();
94
+ this.deviceAddressToLocalAddress.clear();
95
+ this.localAddressToHandler.clear();
88
96
  // No need to close the stream, device will close it
89
97
  }
90
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"reverse.js","sourceRoot":"","sources":["../../src/commands/reverse.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,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WAAW,CAAC,uBAAuB,aAAa,EAAE,CAAC,CAAC;QAE/D,IAAI,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACrD,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,aAAa,CAAE,CAAC,CAAC;YACxF,IAAI,CAAC,2BAA2B,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;SAC1D;QAED,oDAAoD;IACxD,CAAC;IAEM,KAAK,CAAC,SAAS;QAClB,MAAM,IAAI,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC;QAElD,IAAI,CAAC,2BAA2B,CAAC,KAAK,EAAE,CAAC;QACzC,IAAI,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;QAEnC,oDAAoD;IACxD,CAAC;CACJ"}
@@ -1,24 +1,22 @@
1
1
  import type { Adb } from '../../adb.js';
2
- import type { AdbSubprocessProtocol, AdbSubprocessProtocolConstructor } from './types.js';
3
- export * from './legacy.js';
4
- export * from './protocol.js';
5
- export * from './types.js';
2
+ import { type AdbSubprocessProtocol, type AdbSubprocessProtocolConstructor } from './protocols/index.js';
3
+ export * from './protocols/index.js';
6
4
  export * from './utils.js';
7
5
  export interface AdbSubprocessOptions {
8
6
  /**
9
- * A list of `AdbShellConstructor`s to be used.
7
+ * A list of `AdbSubprocessProtocolConstructor`s to be used.
10
8
  *
11
- * Different `AdbShell` has different capabilities, thus requires specific adaptations.
12
- * Check each `AdbShell`'s documentation for details.
9
+ * Different `AdbSubprocessProtocol` has different capabilities, thus requires specific adaptations.
10
+ * Check their documentations for details.
13
11
  *
14
- * The first one whose `isSupported` returns `true` will be used.
15
- * If no `AdbShell` is supported, an error will be thrown.
12
+ * The first protocol whose `isSupported` returns `true` will be used.
13
+ * If no `AdbSubprocessProtocol` is supported, an error will be thrown.
16
14
  *
17
- * The default value is `[AdbShellProtocol, AdbLegacyShell]`.
15
+ * @default [AdbSubprocessShellProtocol, AdbSubprocessNoneProtocol]
18
16
  */
19
17
  protocols: AdbSubprocessProtocolConstructor[];
20
18
  }
21
- export interface SubprocessResult {
19
+ export interface AdbSubprocessWaitResult {
22
20
  stdout: string;
23
21
  stderr: string;
24
22
  exitCode: number;
@@ -28,25 +26,26 @@ export declare class AdbSubprocess {
28
26
  constructor(adb: Adb);
29
27
  private createProtocol;
30
28
  /**
31
- * Spawns the default shell in interactive mode.
32
- * @param options The options for creating the `AdbShell`
33
- * @returns A new `AdbShell` instance connecting to the spawned shell process.
29
+ * Spawns an executable in PTY (interactive) mode.
30
+ * @param command The command to run. If omitted, the default shell will be spawned.
31
+ * @param options The options for creating the `AdbSubprocessProtocol`
32
+ * @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
34
33
  */
35
- shell(options?: Partial<AdbSubprocessOptions>): Promise<AdbSubprocessProtocol>;
34
+ shell(command?: string | string[], options?: Partial<AdbSubprocessOptions>): Promise<AdbSubprocessProtocol>;
36
35
  /**
37
- * Spawns a new process using the given `command`.
36
+ * Spawns an executable and pipe the output.
38
37
  * @param command The command to run, or an array of strings containing both command and args.
39
- * @param options The options for creating the `AdbShell`
40
- * @returns A new `AdbShell` instance connecting to the spawned process.
38
+ * @param options The options for creating the `AdbSubprocessProtocol`
39
+ * @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
41
40
  */
42
41
  spawn(command: string | string[], options?: Partial<AdbSubprocessOptions>): Promise<AdbSubprocessProtocol>;
43
42
  /**
44
43
  * Spawns a new process, waits until it exits, and returns the entire output.
45
44
  * @param command The command to run
46
- * @param options The options for creating the `AdbShell`
45
+ * @param options The options for creating the `AdbSubprocessProtocol`
47
46
  * @returns The entire output of the command
48
47
  */
49
- spawnAndWait(command: string | string[], options?: Partial<AdbSubprocessOptions>): Promise<SubprocessResult>;
48
+ spawnAndWait(command: string | string[], options?: Partial<AdbSubprocessOptions>): Promise<AdbSubprocessWaitResult>;
50
49
  /**
51
50
  * Spawns a new process, waits until it exits, and returns the entire output.
52
51
  * @param command The command to run
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAIxC,OAAO,KAAK,EAAE,qBAAqB,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;AAE1F,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAE3B,MAAM,WAAW,oBAAoB;IACjC;;;;;;;;;;OAUG;IACH,SAAS,EAAE,gCAAgC,EAAE,CAAC;CACjD;AAMD,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,aAAa;IACtB,SAAgB,GAAG,EAAE,GAAG,CAAC;gBAEN,GAAG,EAAE,GAAG;YAIb,cAAc;IAkB5B;;;;OAIG;IACI,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIrF;;;;;OAKG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAOjH;;;;;OAKG;IACU,YAAY,CACrB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACxC,OAAO,CAAC,gBAAgB,CAAC;IAsB5B;;;;OAIG;IACU,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAI/E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAyD,KAAK,qBAAqB,EAAE,KAAK,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAEhK,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAE3B,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,aAAa;IACtB,SAAgB,GAAG,EAAE,GAAG,CAAC;gBAEN,GAAG,EAAE,GAAG;YAIb,cAAc;IA6B5B;;;;;OAKG;IACI,KAAK,CACR,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GACxC,OAAO,CAAC,qBAAqB,CAAC;IAIjC;;;;;OAKG;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;IAuBnC;;;;OAIG;IACU,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAO/E"}
@@ -1,22 +1,20 @@
1
1
  import { DecodeUtf8Stream, GatherStringStream } from "../../stream/index.js";
2
- import { AdbNoneSubprocessProtocol } from './legacy.js';
3
- import { AdbShellSubprocessProtocol } from './protocol.js';
4
- export * from './legacy.js';
5
- export * from './protocol.js';
6
- export * from './types.js';
2
+ import { AdbSubprocessNoneProtocol, AdbSubprocessShellProtocol } from './protocols/index.js';
3
+ export * from './protocols/index.js';
7
4
  export * from './utils.js';
8
- const DefaultOptions = {
9
- protocols: [AdbShellSubprocessProtocol, AdbNoneSubprocessProtocol],
5
+ const DEFAULT_OPTIONS = {
6
+ protocols: [AdbSubprocessShellProtocol, AdbSubprocessNoneProtocol],
10
7
  };
11
8
  export class AdbSubprocess {
12
9
  adb;
13
10
  constructor(adb) {
14
11
  this.adb = adb;
15
12
  }
16
- async createProtocol(command, options) {
17
- let { protocols } = { ...DefaultOptions, ...options };
13
+ async createProtocol(mode, command, options) {
14
+ const { protocols } = { ...DEFAULT_OPTIONS, ...options };
18
15
  let Constructor;
19
16
  for (const item of protocols) {
17
+ // It's async so can't use `Array#find`
20
18
  if (await item.isSupported(this.adb)) {
21
19
  Constructor = item;
22
20
  break;
@@ -25,45 +23,52 @@ export class AdbSubprocess {
25
23
  if (!Constructor) {
26
24
  throw new Error('No specified protocol is supported by the device');
27
25
  }
28
- return await Constructor.spawn(this.adb, command);
26
+ if (Array.isArray(command)) {
27
+ command = command.join(' ');
28
+ }
29
+ else if (command === undefined) {
30
+ // spawn the default shell
31
+ command = '';
32
+ }
33
+ return await Constructor[mode](this.adb, command);
29
34
  }
30
35
  /**
31
- * Spawns the default shell in interactive mode.
32
- * @param options The options for creating the `AdbShell`
33
- * @returns A new `AdbShell` instance connecting to the spawned shell process.
36
+ * Spawns an executable in PTY (interactive) mode.
37
+ * @param command The command to run. If omitted, the default shell will be spawned.
38
+ * @param options The options for creating the `AdbSubprocessProtocol`
39
+ * @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
34
40
  */
35
- shell(options) {
36
- return this.createProtocol('', options);
41
+ shell(command, options) {
42
+ return this.createProtocol('pty', command, options);
37
43
  }
38
44
  /**
39
- * Spawns a new process using the given `command`.
45
+ * Spawns an executable and pipe the output.
40
46
  * @param command The command to run, or an array of strings containing both command and args.
41
- * @param options The options for creating the `AdbShell`
42
- * @returns A new `AdbShell` instance connecting to the spawned process.
47
+ * @param options The options for creating the `AdbSubprocessProtocol`
48
+ * @returns A new `AdbSubprocessProtocol` instance connecting to the spawned process.
43
49
  */
44
50
  spawn(command, options) {
45
- if (Array.isArray(command)) {
46
- command = command.join(' ');
47
- }
48
- return this.createProtocol(command, options);
51
+ return this.createProtocol('raw', command, options);
49
52
  }
50
53
  /**
51
54
  * Spawns a new process, waits until it exits, and returns the entire output.
52
55
  * @param command The command to run
53
- * @param options The options for creating the `AdbShell`
56
+ * @param options The options for creating the `AdbSubprocessProtocol`
54
57
  * @returns The entire output of the command
55
58
  */
56
59
  async spawnAndWait(command, options) {
57
60
  const shell = await this.spawn(command, options);
58
61
  const stdout = new GatherStringStream();
59
- shell.stdout
60
- .pipeThrough(new DecodeUtf8Stream())
61
- .pipeThrough(stdout);
62
62
  const stderr = new GatherStringStream();
63
- shell.stderr
64
- .pipeThrough(new DecodeUtf8Stream())
65
- .pipeThrough(stderr);
66
- const exitCode = await shell.exit;
63
+ const [, , exitCode] = await Promise.all([
64
+ shell.stdout
65
+ .pipeThrough(new DecodeUtf8Stream())
66
+ .pipeTo(stdout),
67
+ shell.stderr
68
+ .pipeThrough(new DecodeUtf8Stream())
69
+ .pipeTo(stderr),
70
+ shell.exit
71
+ ]);
67
72
  return {
68
73
  stdout: stdout.result,
69
74
  stderr: stderr.result,
@@ -76,7 +81,7 @@ export class AdbSubprocess {
76
81
  * @returns The entire output of the command
77
82
  */
78
83
  async spawnAndWaitLegacy(command) {
79
- const { stdout } = await this.spawnAndWait(command, { protocols: [AdbNoneSubprocessProtocol] });
84
+ const { stdout } = await this.spawnAndWait(command, { protocols: [AdbSubprocessNoneProtocol] });
80
85
  return stdout;
81
86
  }
82
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/subprocess/index.ts"],"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Ac,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,YAAY,CACrB,OAA0B,EAC1B,OAAuC;QAEvC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACxC,MAAM,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAExC,MAAM,CAAC,EAAE,AAAD,EAAG,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACrC,KAAK,CAAC,MAAM;iBACP,WAAW,CAAC,IAAI,gBAAgB,EAAE,CAAC;iBACnC,MAAM,CAAC,MAAM,CAAC;YACnB,KAAK,CAAC,MAAM;iBACP,WAAW,CAAC,IAAI,gBAAgB,EAAE,CAAC;iBACnC,MAAM,CAAC,MAAM,CAAC;YACnB,KAAK,CAAC,IAAI;SACb,CAAC,CAAC;QAEH,OAAO;YACH,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,QAAQ;SACX,CAAC;IACN,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,kBAAkB,CAAC,OAA0B;QACtD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,YAAY,CACtC,OAAO,EACP,EAAE,SAAS,EAAE,CAAC,yBAAyB,CAAC,EAAE,CAC7C,CAAC;QACF,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
@@ -1,7 +1,7 @@
1
- import type { Adb } from "../../adb.js";
2
- import type { AdbSocket } from "../../socket/index.js";
3
- import { type ReadableStream } from "../../stream/index.js";
4
- import type { AdbSubprocessProtocol } from "./types.js";
1
+ import type { Adb } from "../../../../src/adb.js";
2
+ import type { AdbSocket } from "../../../../src/socket/index.js";
3
+ import { type ReadableStream } from "../../../../src/stream/index.js";
4
+ import type { AdbSubprocessProtocol } from "../../../../src/commands/subprocess/types.js";
5
5
  /**
6
6
  * The legacy shell
7
7
  *
@@ -10,14 +10,21 @@ import type { AdbSubprocessProtocol } from "./types.js";
10
10
  * * `exit` exit code: No
11
11
  * * `resize`: No
12
12
  */
13
- export declare class AdbNoneSubprocessProtocol implements AdbSubprocessProtocol {
13
+ export declare class AdbSubprocessNoneProtocol implements AdbSubprocessProtocol {
14
14
  static isSupported(): boolean;
15
- static spawn(adb: Adb, command: string): Promise<AdbNoneSubprocessProtocol>;
15
+ static pty(adb: Adb, command: string): Promise<AdbSubprocessNoneProtocol>;
16
+ static raw(adb: Adb, command: string): Promise<AdbSubprocessNoneProtocol>;
16
17
  private readonly socket;
17
18
  get stdin(): import("web-streams-polyfill").WritableStream<Uint8Array>;
18
19
  private _stdout;
20
+ /**
21
+ * Legacy shell mixes stdout and stderr.
22
+ */
19
23
  get stdout(): ReadableStream<Uint8Array>;
20
24
  private _stderr;
25
+ /**
26
+ * `stderr` will always be empty.
27
+ */
21
28
  get stderr(): ReadableStream<Uint8Array>;
22
29
  private _exit;
23
30
  get exit(): Promise<number>;
@@ -25,4 +32,4 @@ export declare class AdbNoneSubprocessProtocol implements AdbSubprocessProtocol
25
32
  resize(): void;
26
33
  kill(): Promise<void>;
27
34
  }
28
- //# sourceMappingURL=legacy.d.ts.map
35
+ //# sourceMappingURL=legacy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/legacy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD;;;;;;;GAOG;AACH,qBAAa,yBAA0B,Y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,19 +7,28 @@ import { DuplexStreamFactory } from "../../stream/index.js";
7
7
  * * `exit` exit code: No
8
8
  * * `resize`: No
9
9
  */
10
- export class AdbNoneSubprocessProtocol {
10
+ export class AdbSubprocessNoneProtocol {
11
11
  static isSupported() { return true; }
12
- static async spawn(adb, command) {
13
- return new AdbNoneSubprocessProtocol(await adb.createSocket(`shell:${command}`));
12
+ static async pty(adb, command) {
13
+ return new AdbSubprocessNoneProtocol(await adb.createSocket(`shell:${command}`));
14
+ }
15
+ static async raw(adb, command) {
16
+ // Native ADB client doesn't allow none protocol + raw mode,
17
+ // But ADB daemon supports it.
18
+ return new AdbSubprocessNoneProtocol(await adb.createSocket(`shell,raw:${command}`));
14
19
  }
15
20
  socket;
16
21
  // Legacy shell forwards all data to stdin.
17
22
  get stdin() { return this.socket.writable; }
18
23
  _stdout;
19
- // Legacy shell doesn't support splitting output streams.
24
+ /**
25
+ * Legacy shell mixes stdout and stderr.
26
+ */
20
27
  get stdout() { return this._stdout; }
21
- // `stderr` of Legacy shell is always empty.
22
28
  _stderr;
29
+ /**
30
+ * `stderr` will always be empty.
31
+ */
23
32
  get stderr() { return this._stderr; }
24
33
  _exit;
25
34
  get exit() { return this._exit; }
@@ -1 +1 @@
1
- {"version":3,"file":"legacy.js","sourceRoot":"","sources":["../../../src/commands/subprocess/legacy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,uBAAuB,CAAC;AAGjF;;;;;;;GAOG;AACH,MAAM,OAAO,yBAAyB;IAC3B,MAAM,CAAC,WAAW,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAErC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAQ,EAAE,OAAe;QAC/C,OAAO,IAAI,yBAAyB,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;IAEgB,MAAM,CAAY;IAEnC,2CAA2C;IAC3C,IAAW,KAAK,KAA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EAAE,CAAC,CAAC,CAAC,CAAC;IAC9C,CAAC;IAEM,MAAM;QACT,gBAAgB;IACpB,CAAC;IAEM,IAAI;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;CACJ"}
@@ -18,9 +18,10 @@ export declare enum AdbShellProtocolId {
18
18
  * * `exit` exit code: Yes
19
19
  * * `resize`: Yes
20
20
  */
21
- export declare class AdbShellSubprocessProtocol implements AdbSubprocessProtocol {
21
+ export declare class AdbSubprocessShellProtocol implements AdbSubprocessProtocol {
22
22
  static isSupported(adb: Adb): boolean;
23
- static spawn(adb: Adb, command: string): Promise<AdbShellSubprocessProtocol>;
23
+ static pty(adb: Adb, command: string): Promise<AdbSubprocessShellProtocol>;
24
+ static raw(adb: Adb, command: string): Promise<AdbSubprocessShellProtocol>;
24
25
  private readonly _socket;
25
26
  private _socketWriter;
26
27
  private _stdin;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/commands/subprocess/protocol.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAsB,cAAc,EAAmE,cAAc,EAAkE,MAAM,uBAAuB,CAAC;AAE5N,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,oBAAY,kBAAkB;IAC1B,KAAK,IAAA;IACL,MAAM,IAAA;IACN,MAAM,IAAA;IACN,IAAI,IAAA;IACJ,UAAU,IAAA;IACV,gBAAgB,IAAA;CACnB;AA6ED;;;;;;;GAOG;AACH,qBAAa,0BAA2B,YAAW,qBAAqB;WACtD,WAAW,CAAC,GAAG,EAAE,GAAG;WAId,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;IAMnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAY;IACpC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W,MAAM,+BAA2B;IAE5C,OAAO,CAAC,OAAO,CAA6B;IAC5C,IAAW,MAAM,+BAA2B;IAE5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,IAAW,IAAI,oBAAiC;gBAE7B,MAAM,EAAE,SAAS;IA0CvB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAYvC,IAAI;CAGd"}
@@ -84,14 +84,16 @@ class MultiplexStream {
84
84
  * * `exit` exit code: Yes
85
85
  * * `resize`: Yes
86
86
  */
87
- export class AdbShellSubprocessProtocol {
87
+ export class AdbSubprocessShellProtocol {
88
88
  static isSupported(adb) {
89
89
  return adb.features.includes(AdbFeatures.ShellV2);
90
90
  }
91
- static async spawn(adb, command) {
92
- // TODO: AdbShellSubprocessProtocol: Support raw mode
91
+ static async pty(adb, command) {
93
92
  // TODO: AdbShellSubprocessProtocol: Support setting `XTERM` environment variable
94
- return new AdbShellSubprocessProtocol(await adb.createSocket(`shell,v2,pty:${command}`));
93
+ return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,pty:${command}`));
94
+ }
95
+ static async raw(adb, command) {
96
+ return new AdbSubprocessShellProtocol(await adb.createSocket(`shell,v2,raw:${command}`));
95
97
  }
96
98
  _socket;
97
99
  _socketWriter;
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/commands/subprocess/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,MAAM,EAAE,EAAE,WAAW,EAAwB,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAkB,uBAAuB,EAAE,qBAAqB,EAAE,eAAe,EAAE,cAAc,EAAkE,MAAM,uBAAuB,CAAC;AAC5N,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,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0,0 +1,4 @@
1
+ export * from './none.js';
2
+ export * from './shell.js';
3
+ export * from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './none.js';
2
+ export * from './shell.js';
3
+ export * from './types.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/subprocess/protocols/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}