Skip to content
Snippets Groups Projects
Commit a0c1eab5 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] #1292 Crash on Windows

parent efe8992f
No related branches found
No related tags found
1 merge request!12631.6
......@@ -15,6 +15,7 @@
const moment = require('moment');
const path = require('path');
const winston = require('winston');
const directory = require('../lib/system/directory');
/***************
* CALLBACK LOGGER
......@@ -147,6 +148,11 @@ logger.unmute = () => {
}
}
/**
* Default logging path
*/
logger.addHomeLogs(directory.INSTANCE_HOME)
/**
* Convenience function to get logger directly
*/
......
......@@ -2,27 +2,28 @@
"use strict";
const co = require('co');
const duniter = require('../index');
const stack = duniter.statics.autoStack();
const logger = require("../app/lib/logger").NewLogger();
return co(function*() {
// Specific errors handling
process.on('uncaughtException', (err) => {
// Dunno why this specific exception is not caught
if (err.code && err.code !== "EADDRNOTAVAIL" && err.code !== "EINVAL" && err.code !== "ENOENT") {
logger.error(err.stack || err.message || err);
process.exit(2);
}
});
// Specific errors handling
process.on('uncaughtException', (err) => {
// Dunno why this specific exception is not caught
if (err.code !== "EADDRNOTAVAIL" && err.code !== "EINVAL" && err.code !== "ENOENT") {
duniter.statics.logger.error(err);
process.exit(2);
}
});
return co(function*() {
try {
const duniter = require('../index');
const stack = duniter.statics.autoStack();
yield stack.executeStack(process.argv);
// Everything went well, close Duniter quietly.
process.exit();
} catch (e) {
// If an unhandled error occured
duniter.statics.logger.error(e);
logger.error(e.stack || e.message || e);
process.exit(1);
} finally {
// If we did not succeed to close before, force close with error.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment