Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var timer ;
function fire() {
unlooped = true;
if (looped) {
looped = false;
loop.unloop();
}
if (timer) {
clearTimeout(timer);
timer = null;
}
}
Co.fs.stat(__filename, function(err, stat2) {
Co.println("stat2");
fire();
});
timer = setTimeout(function() {
Co.println('unloop');
fire();
});
if (!unlooped) {
looped = true;
loop.loop(); // wait
}
});
Co.path.exists(filename, function(err, exists) {
if (err) throw err;
assert.equal(exists, true);
Co.fs.readFile(filename, function(err, content) {
if (err) throw err;
assert.equal(content, 'teardown '+installingDir); // should be cwd.
return done();
});
});
});
_readContent: function(callback) {
this.readCount++;
var repo = this;
Co.fs.readFile(repo.path, function(err, content) {
if (err) return callback(err);
repo.content = content;
callback(null); // ok!
});
},
// ==========================================================================
// Project: Seed - Flexible Package Manager
// Copyright: ©2009-2010 Apple Inc. All rights reserved.
// License: Licened under MIT license (see __preamble__.js)
// ==========================================================================
/*global process path sys assert libDir __filename */
var Ct = require('core_test:sync');
var loop = require('private/loop');
var Co = require('private/co');
Co.fs.stat(__filename, function(err, stat) {
Co.println("stat1");
var looped = false;
var unlooped = false;
var timer ;
function fire() {
unlooped = true;
if (looped) {
looped = false;
loop.unloop();
}
if (timer) {
clearTimeout(timer);
timer = null;
Co.path.exists(filename, function(err, exists) {
if (err) return done(err);
if (exists) return Co.fs.rm(filename, done);
else done();
});
});