| 36 | |
| 37 | /* istanbul ignore next */ |
| 38 | function checkSocketPath(finalConfig) { |
| 39 | const passed = xprofiler.checkSocketPath(true); |
| 40 | if (!passed) { |
| 41 | const message = 'socket path is too long, complete log of this error can be found in:\n' |
| 42 | + ` ${path.join(finalConfig.log_dir, `xprofiler-error-${moment().format('YYYYMMDD')}.log`)}\n`; |
| 43 | if (finalConfig.check_throw) { |
| 44 | throw new Error(message); |
| 45 | } |
| 46 | console.error(`\n[${moment().format('YYYY-MM-DD HH:mm:ss')}] [error] [xprofiler-ipc] [${pkg.version}] ${message}`); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | return passed; |
| 51 | } |
| 52 | |
| 53 | function runOnce(onceKey, onceFunc) { |
| 54 | checkNecessary(); |