Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[improvement behavior] Make lost in space-time nearby more intellectual and user-friendly #2601

Open
akruphi opened this issue Dec 27, 2024 · 1 comment

Comments

@akruphi
Copy link
Contributor

akruphi commented Dec 27, 2024

Now terminal version far2l show information

Some far2l-s lost in space-time nearby:
1:
...
Input instance index to revive or empty string to spawn new far2l

if detect files srv-*.info in /tmp/far2l_<magic_numbers>/TTY (see

void TTYRevivableEnum(std::vector<TTYRevivableInstance> &instances)
{
std::string ipc_path = InMyTemp("TTY/");
instances.clear();
const std::string &tty_dir = InMyTemp("TTY");
DIR *d = opendir(tty_dir.c_str());
if (!d) {
return;
}
for (;;) {
dirent *de = readdir(d);
if (!de) break;
if (MatchWildcard(de->d_name, "srv-*.info")) {
unsigned long pid = 0;
sscanf(de->d_name, "srv-%lu.info", &pid);
if (pid > 1) {
std::string info_file = tty_dir;
info_file+= '/';
info_file+= de->d_name;
TTYInfoReader info_reader(info_file);
instances.emplace_back(TTYRevivableInstance{info_reader.Text(), (pid_t)pid});
}
}
}
closedir(d);
}
)

But sometimes process with such pid may not exist now and may actually be killed. May be in TTYRevivableEnum() make additional verify and show only the really living ones.

@elfmz я в этом коде ничего не понимаю. Насколько реальна реализация такой дополнительной проверки? Или есть опасения, что она поломает детектирование или подвесит и эту копию far2l при проведении такой проверки?

@unxed
Copy link
Contributor

unxed commented Dec 27, 2024

Мне тоже такое в голову приходило. Ну и надо как-то чистить файлы, указывающие на несуществующие процессы.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants