Skip to content

Commit

Permalink
Add API to execute a remote shell command via socket interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
Helder Correia committed Oct 28, 2010
1 parent d2e63af commit 83fd05c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions remotejs/src/shell/adb.py
Expand Up @@ -99,6 +99,23 @@ def devices():
list.append(re.sub(r'\s*device', '', elem))
return list

def shell(cmd):
ok, socket = startConnection()
if not ok:
return None
sendData(socket, 'shell:' + cmd)
if readOkay(socket):
data = readData(socket)
result = ""
while len(data):
result += data
data = readData(socket)
endConnection(socket)
return result
else:
endConnection(socket)
return None

def isAvailable():
return query('version').startswith('Android Debug Bridge')

Expand Down

0 comments on commit 83fd05c

Please sign in to comment.