process.on('exit', function () {
setTimeout(function () {
console.log('This will not run');
}, 100);
console.log('Bye.');
});
process.on('uncaughtException', function (err) {
console.log('Caught exception: ' + err);
});
setTimeout(function () {
console.log('This will still run.');
}, 500);
// Intentionally cause an exception, but don't catch it.
nonexistentFunc();
console.log('This will not run.');
var http = require('http');
var server = http.createServer(function(req,res) {
res.writeHead(200, {});
res.end('response');
badLoggingCall('sent response');
console.log('sent response');
});
process.on('uncaughtException', function(e) {
console.log(e);
});
server.listen(8080);
var http = require('http');
var s = http.createServer(function(req, res) {
res.writeHead(200, {});
res.end('foo');
console.log('http response');
process.nextTick(function(){console.log('tick')});
});
s.listen(8000);
process.on('uncaughtException', function(e) {
console.log(e);
});
process.nextTick(function() {
console.log('tick');
});
process.nextTick(function() {
iAmAMistake();
console.log('tock');
});
process.nextTick(function() {
console.log('tick tock');
});
console.log('End of 1st loop');
var cp = require('child_process');
cp.exec('ls -l', function(e, stdout, stderr) {
if(!e) {
console.log(stdout);
console.log(stderr);
}
});
var options = {
encoding: 'utf8',
timeout: 0,
maxBuffer: 200 * 1024,
killSignal: 'SIGTERM',
setsid: false,
cwd: null,
env: null
};
var cp = require('child_process');
cp.exec('ls -l', options, function(e, stdout, stderr) {
if(!e) {
console.log(stdout);
console.log(stderr);
}
});
var cp = require('child_process');
var cat = cp.spawn('cat');
cat.stdout.on('data', function(d) {
console.log(d.toString());
});
cat.on('exit', function() {
console.log('kthxbai');
});
cat.stdin.write('meow');
cat.stdin.end();
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有