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 @@ ...@@ -15,6 +15,7 @@
const moment = require('moment'); const moment = require('moment');
const path = require('path'); const path = require('path');
const winston = require('winston'); const winston = require('winston');
const directory = require('../lib/system/directory');
/*************** /***************
* CALLBACK LOGGER * CALLBACK LOGGER
...@@ -147,6 +148,11 @@ logger.unmute = () => { ...@@ -147,6 +148,11 @@ logger.unmute = () => {
} }
} }
/**
* Default logging path
*/
logger.addHomeLogs(directory.INSTANCE_HOME)
/** /**
* Convenience function to get logger directly * Convenience function to get logger directly
*/ */
......
...@@ -2,27 +2,28 @@ ...@@ -2,27 +2,28 @@
"use strict"; "use strict";
const co = require('co'); const co = require('co');
const duniter = require('../index'); const logger = require("../app/lib/logger").NewLogger();
const stack = duniter.statics.autoStack();
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 return co(function*() {
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);
}
});
try { try {
const duniter = require('../index');
const stack = duniter.statics.autoStack();
yield stack.executeStack(process.argv); yield stack.executeStack(process.argv);
// Everything went well, close Duniter quietly. // Everything went well, close Duniter quietly.
process.exit(); process.exit();
} catch (e) { } catch (e) {
// If an unhandled error occured // If an unhandled error occured
duniter.statics.logger.error(e); logger.error(e.stack || e.message || e);
process.exit(1); process.exit(1);
} finally { } finally {
// If we did not succeed to close before, force close with error. // 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