diff options
author | Jesse Luehrs <doy@tozt.net> | 2018-11-01 13:39:44 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2018-11-01 13:39:44 -0400 |
commit | ac04c3b53aca892a44cbd0a391fe6ecc42abc861 (patch) | |
tree | c89617c797f10648062289f4618bc404cb79a633 /bin | |
parent | d0fda6512bd1eae0505b2cfcee4a7b56d8b0b65c (diff) | |
download | conf-ac04c3b53aca892a44cbd0a391fe6ecc42abc861.tar.gz conf-ac04c3b53aca892a44cbd0a391fe6ecc42abc861.zip |
make this work on python 2 and 3
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/web | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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}" |