Skip to content

Instantly share code, notes, and snippets.

@savelee
Created June 15, 2016 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savelee/61082f5ae084688bf9c479209346005f to your computer and use it in GitHub Desktop.
Save savelee/61082f5ae084688bf9c479209346005f to your computer and use it in GitHub Desktop.
Sencha Test Child Process script
var ChildProcess = require('child_process'),
spawn = ChildProcess.spawn,
shell = process.argv.indexOf('--shell') !== -1,
detached = process.argv.indexOf('--detached') !== -1;
if (process.argv.length < 3) {
console.log('Usage: node app_watch.js /path/to/app [--shell] [--detached]')
} else {
console.log('shell:', shell, 'detached:', detached);
var cmd = spawn('/Users/leeboonstra/bin/Sencha/Cmd/6.2.0.52/sencha', ['-debug', 'app', 'watch'], {
//var cmd = spawn('sencha', ['app', 'watch'], {
cwd: process.argv[2],
shell: '/bin/bash',
env: {},
detached: detached
});
cmd.stdout.on('data', function(data) {
var lines = data.toString().split('\n');
lines.forEach(function(line) { console.log(line) });
});
process.on('SIGINT', function() {
process.kill(-cmd.pid);
process.exit(0);
});
}
//run this as node node_app_watch.js from a Sencha application, and note the logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment