dotfiles/.vscode/extensions/vscodevim.vim-0.2.0/node_modules/sync-exec/js/lib/create-pipes.js

32 lines
777 B
JavaScript
Raw Normal View History

2016-09-11 09:29:13 +01:00
// Generated by CoffeeScript 1.9.3
(function() {
var fs, timeout;
fs = require('fs');
timeout = require('./timeout');
module.exports = function() {
var created, dir, i, len, name, ref, t_limit, tmp_dir;
t_limit = Date.now() + 1000;
tmp_dir = '/tmp';
ref = ['TMPDIR', 'TMP', 'TEMP'];
for (i = 0, len = ref.length; i < len; i++) {
name = ref[i];
if ((dir = process.env[name]) != null) {
tmp_dir = dir.replace(/\/$/, '');
}
}
while (!created) {
try {
dir = tmp_dir + '/sync-exec-' + Math.floor(Math.random() * 1000000000);
fs.mkdir(dir);
created = true;
} catch (_error) {}
timeout(t_limit, 'Can not create sync-exec directory');
}
return dir;
};
}).call(this);