From d99dbd5878a2671a75706fbd1ab6dea0408fa325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Sun, 12 Nov 2017 22:47:07 -0800 Subject: [PATCH] Add first support to auto-open URLs --- slides/autotest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/slides/autotest.py b/slides/autotest.py index bb479c70..134387aa 100755 --- a/slides/autotest.py +++ b/slides/autotest.py @@ -260,6 +260,13 @@ while i < len(actions): # FIXME: we should factor out the "bash" method wait_for_prompt() check_exit_status() + elif method == "open": + # Cheap way to get node1's IP address + screen = capture_pane() + ipaddr = re.findall("^\[(.*)\]", screen, re.MULTILINE)[-1] + url = data.replace("/node1", "/{}".format(ipaddr)) + # This should probably be adapted to run on different OS + subprocess.check_call(["open", url]) else: logging.warning("Unknown method {}: {!r}".format(method, data)) i += 1