Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var exec = require('child_process').exec;
- var fs = require('fs');
- let LineReader = require('readline');
- var execute = function(command, cb) {
- var child = exec(command, function(err, stdout, stderr) {
- if (err != null) {
- return cb(new Error(err), null);
- } else if (typeof stderr != 'string') {
- return cb(new Error(stderr), null);
- } else {
- return cb(null, stdout);
- }
- });
- };
- let readerInterface = LineReader.createInterface({
- input: fs.createReadStream('data')
- });
- readerInterface.on('line', function(line) {
- console.log('branch:', line);
- execute(`git branch -D ${line}`, function(err, result) {
- console.log(err, result);
- });
- });
Add Comment
Please, Sign In to add comment