From c03c5412fcd38aef2ccb3fd72be34fe2d557d23f Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Fri, 27 Jul 2012 15:59:46 +0200 Subject: .functions: Attempt to make `server` open the browser *after* the server has started --- .functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.functions') diff --git a/.functions b/.functions index 1754c93..8aa20c8 100644 --- a/.functions +++ b/.functions @@ -19,7 +19,7 @@ dataurl() { # Start an HTTP server from a directory, optionally specifying the port function server() { local port="${1:-8000}" - open "http://localhost:${port}/" + sleep 1 && open "http://localhost:${port}/" & # Set the default Content-Type to `text/plain` instead of `application/octet-stream` # And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" -- cgit v1.2.3