* Description * @method describeProcess * @param {} pm2_id * @return
(pm2_id, cb)
| 1860 | * @return |
| 1861 | */ |
| 1862 | describe (pm2_id, cb) { |
| 1863 | var that = this; |
| 1864 | |
| 1865 | var found_proc = []; |
| 1866 | |
| 1867 | that.Client.executeRemote('getMonitorData', {}, function(err, list) { |
| 1868 | if (err) { |
| 1869 | Common.printError('Error retrieving process list: ' + err); |
| 1870 | that.exitCli(conf.ERROR_EXIT); |
| 1871 | } |
| 1872 | |
| 1873 | list.forEach(function(proc) { |
| 1874 | if ((!isNaN(pm2_id) && proc.pm_id == pm2_id) || |
| 1875 | (typeof(pm2_id) === 'string' && proc.name == pm2_id)) { |
| 1876 | found_proc.push(proc); |
| 1877 | } |
| 1878 | }); |
| 1879 | |
| 1880 | if (found_proc.length === 0) { |
| 1881 | Common.printError(conf.PREFIX_MSG_WARNING + '%s doesn\'t exist', pm2_id); |
| 1882 | return cb ? cb(null, []) : that.exitCli(conf.ERROR_EXIT); |
| 1883 | } |
| 1884 | |
| 1885 | if (!cb) { |
| 1886 | found_proc.forEach(function(proc) { |
| 1887 | UX.describe(proc); |
| 1888 | }); |
| 1889 | } |
| 1890 | |
| 1891 | return cb ? cb(null, found_proc) : that.exitCli(conf.SUCCESS_EXIT); |
| 1892 | }); |
| 1893 | } |
| 1894 | |
| 1895 | /** |
| 1896 | * API method to perform a deep update of PM2 |
no test coverage detected