Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.js 595B

1234567891011121314151617181920
  1. var spawn = require('child_process').spawn;
  2. module.exports = function (file, opts, cb) {
  3. if (typeof opts === 'function') {
  4. cb = opts;
  5. opts = {};
  6. }
  7. if (!opts) opts = {};
  8. var ed = /^win/.test(process.platform) ? 'notepad' : 'vim';
  9. var editor = opts.editor || process.env.VISUAL || process.env.EDITOR || ed;
  10. var args = editor.split(/\s+/);
  11. var bin = args.shift();
  12. var ps = spawn(bin, args.concat([ file ]), { stdio: 'inherit' });
  13. ps.on('exit', function (code, sig) {
  14. if (typeof cb === 'function') cb(code, sig)
  15. });
  16. };