Built motion from commit c116dc8b.|2.6.30
[motion2.git] / server / api / system / system.controller.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x2d7a=['json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','api','util','bluebird','lodash','error','inspect','status','send','index','getAllData','then','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d7a,0x1e3));var _0xa2d7=function(_0x3af529,_0xf4d73){_0x3af529=_0x3af529-0x0;var _0x5cf4c2=_0x2d7a[_0x3af529];return _0x5cf4c2;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xa2d7('0x0')];var logger=require(_0xa2d7('0x1'))(_0xa2d7('0x2'));var util=require(_0xa2d7('0x3'));var BPromise=require(_0xa2d7('0x4'));var _=require(_0xa2d7('0x5'));function handleError(_0x54da15,_0x37366b,_0x1e25a6){_0x37366b=_0x37366b||0x1f4;return function(_0x40cd00){logger[_0xa2d7('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x1e25a6,_0x37366b,util[_0xa2d7('0x7')](_0x40cd00,{'showHidden':![],'depth':null}));delete _0x40cd00['name'];_0x54da15[_0xa2d7('0x8')](_0x37366b)[_0xa2d7('0x9')](_0x40cd00);};}exports[_0xa2d7('0xa')]=function(_0x5be22c,_0x3f05df){return info[_0xa2d7('0xb')]()[_0xa2d7('0xc')](function(_0xa3724d){return _0x3f05df[_0xa2d7('0x8')](0xc8)['json'](_0xa3724d);})[_0xa2d7('0xd')](function(_0x2855f5){return _0x3f05df[_0xa2d7('0x8')](0x1f4)['json'](_0x2855f5);});};exports['killProcess']=function(_0x334553,_0x453548){var _0x37b909=['components/import/cm'];return new BPromise(function(_0x208b49,_0x140391){return exec(util[_0xa2d7('0xe')](_0xa2d7('0xf'),_0x334553[_0xa2d7('0x10')][_0xa2d7('0x11')]),function(_0x3b00b4,_0x3b29bd,_0x34beba){if(_0x3b00b4){return _0x140391(_0x3b00b4);}return _0x208b49(_0x3b29bd);});})[_0xa2d7('0xc')](function(_0x39c7e5){var _0x598d4b=![];var _0x3514b3=_0x39c7e5[_0xa2d7('0x12')](/\n/);for(var _0x2fe322=0x0,_0x51c31b=_0x37b909[_0xa2d7('0x13')];_0x2fe322<_0x51c31b,_0x598d4b===![];_0x2fe322+=0x1){if(_0x39c7e5[_0xa2d7('0x14')](_0x37b909[_0x2fe322])>=0x0){_0x598d4b=!![];}}if(!_0x598d4b){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x334553[_0xa2d7('0x10')][_0xa2d7('0x11')]));}process['kill'](_0x334553['params'][_0xa2d7('0x11')],'SIGINT');return _0x453548[_0xa2d7('0x8')](0xc8)[_0xa2d7('0x15')]({'message':util[_0xa2d7('0xe')](_0xa2d7('0x16'),_0x334553[_0xa2d7('0x10')][_0xa2d7('0x11')])});})['catch'](handleError(_0x453548,null,_0xa2d7('0x17')));};