refactor installationHandlers.js to simplify installation command execution and remove redundant code

This commit is contained in:
Dmitriy Ryajov 2025-02-25 12:56:03 -06:00
parent 5ed9af4420
commit 0484003a45
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
2 changed files with 6 additions and 20 deletions

View File

@ -151,21 +151,7 @@ async function performInstall(config) {
const downloadCommand = 'curl -# --connect-timeout 10 --max-time 60 -L https://get.codex.storage/install.sh -o install.sh && chmod +x install.sh';
await runCommand(downloadCommand);
if (platform === 'darwin') {
const timeoutCommand = `perl -e '
eval {
local $SIG{ALRM} = sub { die "timeout\\n" };
alarm(120);
system("INSTALL_DIR=\\"${installPath}\\" bash install.sh");
alarm(0);
};
die if $@;
'`;
await runCommand(timeoutCommand);
} else {
await runCommand(`INSTALL_DIR="${installPath}" timeout 120 bash install.sh`);
}
await runCommand(`INSTALL_DIR="${installPath}" timeout 120 bash install.sh`);
await saveCodexExePath(config, path.join(installPath, "codex"));
} catch (error) {