| Server IP : 159.203.156.69 / Your IP : 216.73.216.28 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /proc/self/root/lib/node_modules/pm2/lib/tools/ |
Upload File : |
var execFile = require('child_process').execFile
, path = require('path')
;
/**
* open a file or uri using the default application for the file type.
*
* @return {ChildProcess} - the child process object.
* @param {string} target - the file/uri to open.
* @param {string} appName - (optional) the application to be used to open the
* file (for example, "chrome", "firefox")
* @param {function(Error)} callback - called with null on success, or
* an error object that contains a property 'code' with the exit
* code of the process.
*/
module.exports = open;
function open(target, appName, callback) {
if (typeof(appName) === 'function') {
callback = appName;
appName = null;
}
var cmd;
var args = [];
switch (process.platform) {
case 'darwin':
cmd = 'open';
if (appName) args.push('-a', appName);
args.push(target);
break;
case 'win32':
cmd = 'cmd';
args = ['/c', 'start', '""'];
if (appName) args.push(appName);
args.push(target);
break;
default:
cmd = appName || path.join(__dirname, './xdg-open');
args.push(target);
break;
}
if (process.env.SUDO_USER) {
if (!/^[a-zA-Z0-9._-]+$/.test(process.env.SUDO_USER)) {
return callback && callback(new Error('Invalid SUDO_USER'));
}
args = ['-u', process.env.SUDO_USER, cmd].concat(args);
cmd = 'sudo';
}
return execFile(cmd, args, callback);
}