Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add share executable

Change-Id: Id930bbfe2a930da2abb7140d6b581a2df6e1606c
  • Loading branch information...
commit db2113f9927edb01f33ed2a28ca298013f0ff1b8 1 parent e7f7e72
Tim Caswell authored committed
Showing with 25 additions and 0 deletions.
  1. +25 −0 share.js
View
25 share.js
@@ -0,0 +1,25 @@
+#!/usr/bin/env node
+
+var path = process.cwd();
+var http = require('http');
+var handler = require('stack')(
+ require('creationix/log')(),
+ require('creationix/static')('/', path, 'index.html')
+);
+var PORT = 8080;
+function listen() {
+ try {
+ http.createServer(handler).listen(PORT);
+ console.log("Serving %s at http://localhost:%s/", path, PORT);
+ try {
+ require('child_process').exec('gnome-open http://localhost:' + PORT + '/');
+ console.log("Launching in your default browser");
+ } catch (err) {
+ }
+ } catch (err) {
+ if (err.errno !== 98) { throw err; }
+ PORT++;
+ listen();
+ }
+}
+listen();
Please sign in to comment.
Something went wrong with that request. Please try again.