Skip to content

Commit

Permalink
Improve stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
Katharine committed Jul 15, 2015
1 parent 3c918cb commit 49e88a1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pebble_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def run_tool(args=None):
try:
args.func(args)
except ToolError as e:
parser.exit(message=str(e), status=1)
parser.exit(message=str(e)+"\n", status=1)
sys.exit(1)

@atexit.register
Expand Down
7 changes: 5 additions & 2 deletions pebble_tool/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import os
import os.path
from progressbar import ProgressBar, Bar, FileTransferSpeed, Timer, Percentage
import time

from libpebble2.communication.transports.websocket import WebsocketTransport, MessageTargetPhone
from libpebble2.communication.transports.websocket.protocol import WebSocketInstallBundle, WebSocketInstallStatus
from libpebble2.exceptions import TimeoutError
from libpebble2.services.install import AppInstaller

from .base import PebbleCommand
Expand Down Expand Up @@ -55,7 +55,10 @@ def _install_via_websocket(self, pebble, pbw):
with open(pbw) as f:
print("Installing app...")
pebble.transport.send_packet(WebSocketInstallBundle(pbw=f.read()), target=MessageTargetPhone())
result = pebble.read_transport_message(MessageTargetPhone, WebSocketInstallStatus)
try:
result = pebble.read_transport_message(MessageTargetPhone, WebSocketInstallStatus, timeout=300)
except TimeoutError:
raise ToolError("Timed out waiting for install confirmation.")
if result.status != WebSocketInstallStatus.StatusCode.Success:
raise ToolError("App install failed.")
else:
Expand Down

0 comments on commit 49e88a1

Please sign in to comment.