"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/editor/index.js" (11 Apr 2017, 595 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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