Can't type anything into prompt asking for read access to TERM
Tested Versions: 2.0.1, 2.0.4 OS: macOS Sequoia 15.2 Tested shells: ZSH, bash, sh, fish Tested terminal emulators: iTerm2, wezTerm, Ghostty, Apple Terminal
Absolutely no keyboard input is accepted, including CTRL + C
Passing the --allow-all flag works and the program can be ran normally
My best guess is this might have something to do with macOS secure input, but I'm not entirely certain.
Screenshot:
Could you please share the contents of thfile you're running?
It's a basic encode/decode tool I built for my mathematics class so I could avoid doing all the conversions one by one with a calculator:
// Crypto.cjs
const readline = require('readline');
// Setup readline for user input
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
// Function to prompt user for input
function askQuestion(query) {
return new Promise(resolve => rl.question(query, resolve));
}
// Function to convert message to numerical lookup table values
function messageToNumbers(message) {
const lookup = {
'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9, 'J': 10,
'K': 11, 'L': 12, 'M': 13, 'N': 14, 'O': 15, 'P': 16, 'Q': 17, 'R': 18, 'S': 19,
'T': 20, 'U': 21, 'V': 22, 'W': 23, 'X': 24, 'Y': 25, 'Z': 26, ' ': 27
};
return message.toUpperCase().split('').map(char => lookup[char] || '');
}
// Function to convert numbers to message based on lookup table
function numbersToMessage(numbers) {
const lookup = {
1: 'A', 2: 'B', 3: 'C', 4: 'D', 5: 'E', 6: 'F', 7: 'G', 8: 'H', 9: 'I', 10: 'J',
11: 'K', 12: 'L', 13: 'M', 14: 'N', 15: 'O', 16: 'P', 17: 'Q', 18: 'R', 19: 'S',
20: 'T', 21: 'U', 22: 'V', 23: 'W', 24: 'X', 25: 'Y', 26: 'Z', 27: ' '
};
return numbers.map(num => lookup[num] || '').join('');
}
// Main function
async function main() {
// Ask for encoding or decoding
const choice = await askQuestion("Do you want to encode or decode? (type 'encode' or 'decode'): ");
if (choice !== 'encode' && choice !== 'decode') {
console.log("Invalid choice. Please restart the program.");
rl.close();
return;
}
// Ask for the function
const functionString = await askQuestion("Enter your function (e.g., '4*x' or 'x/4'): ");
let userFunction;
// Create a function based on the input string
try {
userFunction = new Function('x', `return ${functionString}`);
} catch (error) {
console.log("Invalid function. Please restart and try again.");
rl.close();
return;
}
// Ask for the message
const message = await askQuestion(`Enter the message to ${choice}: `);
if (choice === 'encode') {
// Convert message to numbers
const numbers = messageToNumbers(message);
// Encode the message by applying the function to each number
const encoded = numbers.map(num => userFunction(num));
console.log("Encoded message:", encoded.join(' '));
} else if (choice === 'decode') {
// Convert the input message to an array of numbers
const numbers = message.split(' ').map(Number);
// Decode the message by applying the inverse function to each number
const decodedNumbers = numbers.map(num => userFunction(num));
const decodedMessage = numbersToMessage(decodedNumbers);
console.log("Decoded message:", decodedMessage);
}
rl.close();
}
main();
I can reproduce this on linux on multiple terminals (ghostty, alacritty, foot, xterm) with deno run npm:snake-cli
I think the cause would be readline.createInterface now requires --allow-env=TERM.
Is this an oversight or mandatory change on permissions?