]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/node_modules/editor/index.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / node_modules / editor / index.js
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 };