Skip to content

Commit

Permalink
Merge pull request #79 from pinnamur/TIMOB-16740
Browse files Browse the repository at this point in the history
TIMOB-16740 Windows: LiveView server does not automatically start when launched from studio on emulator
  • Loading branch information
ayeung committed Mar 28, 2014
2 parents caa08c3 + 00fad20 commit 088a0b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
18 changes: 13 additions & 5 deletions hook/lvhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,23 @@ exports.init = function(logger, config, cli) {
});

/**
* Start event/file Server
* Start event/file server
*/

cli.addHook('build.post.compile', function(build, finished) {
// kill running server via fserver http api
// kill running server via fserver http api
debug('invoke kill');
http
.get('http://localhost:8324/kill', function(res){})
.on('error', function(e){});
.on('error', function(e){
startServer(finished);
})
.on('data', function(e){})
.on('end', function(e){
startServer(finished);
});
});

function startServer(finished) {
if (cli.argv.liveview) {
debug('Running post:build.post.compile hook');
var binDIR = join(__dirname, '../bin/liveview-server');
Expand All @@ -149,7 +157,7 @@ exports.init = function(logger, config, cli) {
});
}
finished();
});
}
};

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/fserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ FServer.start = function(opts) {
}

if (uri === '/kill') {
response.end('');
fServer.close();
evtServer.close();
rm('-rf', PID_FILE);
response.end('');
process.exit(0);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liveview",
"version": "1.0.3",
"version": "1.0.4",
"description": "Titanium Live Realtime App Development",
"main": "index.js",
"private": true,
Expand Down

0 comments on commit 088a0b2

Please sign in to comment.