Skip to content
Extraits de code Groupes Projets
Vérifiée Valider c00f5cce rédigé par Kubat's avatar Kubat
Parcourir les fichiers

KLKT: Get the last klkt launched in case of lektord restart

parent 122eea9e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!141Improve MPD compatibility
......@@ -4,12 +4,14 @@
- Try to print the backtrace at SEGV
- Assert and abort will trigger a SEGV to try to display the backtrace
- Check if downloaded karas are matroska files (only the magic number)
- In case of restart get the klkt instance launched by the previous lektord
- Add window icon
- Add the Klkt client (notification for desktops) to the lektor project
- Add AppImage builds for lektord, lkt and klkt
- Add basic controls to klkt (play, pause, next, previous, shuffle)
- Add SDL2-Image lib to the dependencies (--with-depends)
- Add klkt autolaunch option to config file
- Add the \_\_flat command to set all priorities to 1 in the queue
- Remove archlinux package support (replaced by AppImage)
- Add MPD commands: seek, seekid, seekcur, delete (partial)
- Fix dl process with the repo module
......
......@@ -103,6 +103,7 @@ void __lkt_log(enum log_level, const char *section, const char *func, const char
#define LKT_ENV_RESTART "__LKT_RESTART"
#define LKT_ENV_CURRENT "__LKT_CURRENT"
#define LKT_ENV_SET_ASSERT "__LKT_SET_ASSERT"
#define LKT_ENV_KLKT_PID "__LKT_KLKT_PID"
#define LKT_LINE_MAX 1024
#define LKT_MAX_SQLITE_STATEMENT 1024
......
......@@ -75,6 +75,11 @@ When built in debug mode (the \fBNDEBUG\fP macro is not defined at compile
time), it is possible to enable asserts by setting this variable to anything
that is not a null string or empty string. By default, asserts are not enabled
in \fBlektord\fP and \fBlkt\fP.
.TP
\fB__LKT_KLKT_PID\fP
Set to the pid of klkt that lektord should kill when restarting. Usefull in
case of a restart with \fBlkt admin restart\fP but you can also set it
yourself.
.SH "SUPPORTED URIS"
When searching the database, the following URIs are supported by lektor. Those
......
......@@ -125,7 +125,16 @@ ___kill_klkt(void)
static inline int
launch_klkt(va_list UNUSED *___args)
{
/* Patch PATH to first search the basedir */
/* Check env variable! */
char *env_klkt_pid = getenv(LKT_ENV_KLKT_PID);
if (NULL != env_klkt_pid) {
LOG_DEBUG("GENERAL", "Found " LKT_ENV_KLKT_PID " := %s", env_klkt_pid);
___klkt_pid = strtol(env_klkt_pid, NULL, 0);
return 0;
}
LOG_DEBUG("GENERAL", "No " LKT_ENV_KLKT_PID " env variable found, launch klkt ourself");
/* Env var was not found, no existing lklt! Launch it ourself. */
char exe_path[LKT_LINE_MAX];
char try_name[LKT_LINE_MAX];
const char *const appimage = getenv("APPIMAGE");
......@@ -183,6 +192,11 @@ error:
end:
LOG_INFO("GENERAL", "Klkt launched with pid %ld", ___klkt_pid, try_name);
posix_spawn_file_actions_destroy(&action);
/* Export the env var for klkt pid, reuse exe_path */
safe_snprintf(exe_path, LKT_LINE_MAX, "%ld", ___klkt_pid);
RETURN_IF(setenv(LKT_ENV_KLKT_PID, exe_path, 1),
"Failed to set env variable " LKT_ENV_KLKT_PID, 1);
return 0;
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter