-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.js
More file actions
34 lines (27 loc) · 777 Bytes
/
process.js
File metadata and controls
34 lines (27 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var log = require('./log');
var filrmgr = require('./filemgr');
var isStop = false;
process.on('exit', function(){
log.error('process exit.');
});
process.on('SIGINT', function() {
log.warn('Got SIGINT. Press Control-D/Control-C to exit.');
taskStop();
});
process.on('uncaughtException',function(err){
log.error('uncaughtException-->'+err.stack+'--'+new Date().toLocaleDateString()+'-'+new Date().toLocaleTimeString());
taskStop();
//process.exit();
});
function checkFinish() {
if( filrmgr.finish_all_buff() )
process.exit();
}
function taskStop() {
isStop = true;
setInterval(checkFinish, 1000);
}
module.exports.is_stop = function () {
return isStop;
};
console.log('run process.js');