summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-11-01 13:39:44 -0400
committerJesse Luehrs <doy@tozt.net>2018-11-01 13:39:44 -0400
commitac04c3b53aca892a44cbd0a391fe6ecc42abc861 (patch)
treec89617c797f10648062289f4618bc404cb79a633 /bin
parentd0fda6512bd1eae0505b2cfcee4a7b56d8b0b65c (diff)
downloadconf-ac04c3b53aca892a44cbd0a391fe6ecc42abc861.tar.gz
conf-ac04c3b53aca892a44cbd0a391fe6ecc42abc861.zip
make this work on python 2 and 3
Diffstat (limited to 'bin')
-rwxr-xr-xbin/web12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/web b/bin/web
index 760c1dd..f8484c0 100755
--- a/bin/web
+++ b/bin/web
@@ -1,3 +1,11 @@
-#!/bin/bash
+#!/bin/sh
+set -eu
+set -o pipefail
-exec python -m http.server ${1:-8000}
+version="$(python -c "import sys; print(sys.version_info[0])")"
+if [ "$version" = "2" ]; then
+ server=SimpleHTTPServer
+else
+ server=http.server
+fi
+exec python -m "$server" "${1:-8000}"