Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: only run application in a screen environment #417

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading