stack/scripts/set-process-title.js
2025-10-20 18:03:55 -07:00

9 lines
477 B
JavaScript

// If not set, set the process title to an abridged version of the command that was used to start the process
function escapeBashString(str) {
return str.replace(/'/g, "'\\''");
}
const shortenedCommand = `node ${process.argv.slice(1).map(a => escapeBashString(a)).join(' ')}`;
process.title = `[stack-auth:${process.env.NEXT_PUBLIC_STACK_PORT_PREFIX || 81}xx] ${process.title || shortenedCommand.length > 200 ? shortenedCommand.slice(0, 200) + '...' : shortenedCommand}`;