Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/adb/DeviceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class DeviceClient {
* `jdwp:<process pid>`
* @returns true
*/
public forward(local: string, remote: string): Bluebird<boolean> {
public forward(local: string, remote: string): Bluebird<number> {
return this.connection().then((conn) => new ForwardCommand(conn).execute(this.serial, local, remote));
}

Expand Down
8 changes: 5 additions & 3 deletions src/adb/command/host-serial/forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ import Command from '../../command';
import Protocol from '../../protocol';
import Bluebird from 'bluebird';

export default class ForwardCommand extends Command<boolean> {
execute(serial: string, local: string, remote: string): Bluebird<boolean> {
export default class ForwardCommand extends Command<number> {
execute(serial: string, local: string, remote: string): Bluebird<number> {
this._send(`host-serial:${serial}:forward:${local};${remote}`);
return this.parser.readAscii(4).then((reply) => {
switch (reply) {
case Protocol.OKAY:
return this.parser.readAscii(4).then((reply) => {
switch (reply) {
case Protocol.OKAY:
return true;
return this.parser.readValue().then((buffer) => {
return Number(buffer.toString());
}).catch(_ => 0);
case Protocol.FAIL:
return this.parser.readError();
default:
Expand Down