HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/.pm2/modules/pm2-logrotate/node_modules/pmx/lib/utils/transport.js
var debug     = require('debug')('axm:transport');
var stringify = require('json-stringify-safe');

var Transport = module.exports = {};

function ipcSend(args, print) {
  /**
   * For debug purpose
   */
  if (process.env.MODULE_DEBUG)
    console.log(args);

  if (!process.send) {
    var output = args.data;
    delete output.__name;
    return false;
  }


  try {
    process.send(JSON.parse(stringify(args)));
  } catch(e) {
    console.error('Process disconnected from parent !');
    console.error(e.stack || e);
    process.exit(1);
  }
};

Transport.send = function(args, print) {
  if (!print) print = false;

  ipcSend(args, print);
};