Skip to content

Commit

Permalink
feat: only run application in a screen environment (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
naomi-lgbt authored Dec 9, 2024
1 parent f5309b0 commit d250e71
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,22 @@ import { barFormatter } from "./tools/barFormatter.js";

dotenv.config();

const isInScreenEnvironment = () => {
return (
process.env.STY !== undefined ||
process.env.SCREEN !== undefined ||
(process.env.TERM !== undefined && process.env.TERMCAP)
);
};

// Anonymous function for IIFE to allow async
(async function () {
console.info(chalk.green(`Hello! Launching email blast application.`));
if (!isInScreenEnvironment()) {
throw new Error(
"You must run this script in a screen session to persist the process after closing the SSH connection."
);
}
/**
* Begin by confirming the environment variables.
*/
Expand Down

0 comments on commit d250e71

Please # to comment.