Permalink
Browse files

using the editor module

  • Loading branch information...
1 parent cdef983 commit f9f9e94e1a13266c5dadc355db95d5338dbac741 @substack committed Jun 13, 2012
Showing with 2 additions and 9 deletions.
  1. +2 −9 index.js
View
@@ -3,6 +3,7 @@ var prompter = require('prompter');
var merge = require('merge');
var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
+var edit = require('editor');
var fs = require('fs');
var path = require('path');
@@ -84,16 +85,8 @@ PkgInit.prototype.edit = function (name, opts, cb) {
}
if (!opts) opts = {};
- var editor = opts.editor || process.env.EDITOR || 'vim';
var file = this.filename(name);
-
- setRaw(true);
- var ps = spawn(editor, [ file ], { customFds : [ 0, 1, 2 ] });
- process.stdin.pipe(ps);
-
- ps.on('exit', function (code, sig) {
- setRaw(false);
- process.stdin.pause();
+ edit(file, opts, function (code, sig) {
if (typeof cb === 'function') cb(code, sig)
});
};

0 comments on commit f9f9e94

Please sign in to comment.