Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
f3194ad4
Vérifiée
Valider
f3194ad4
rédigé
29 janv. 2021
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
KLKT: Don't mix klkt and lektord logs
parent
62a3486e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!140
Auto klkt
Modifications
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
src/main/server.c
+17
-13
17 ajouts, 13 suppressions
src/main/server.c
avec
17 ajouts
et
13 suppressions
src/main/server.c
+
17
−
13
Voir le fichier @
f3194ad4
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include
<lektor/commands.h>
#include
<lektor/commands.h>
#include
<lektor/segv.h>
#include
<lektor/segv.h>
#include
<fcntl.h>
#include
<sys/types.h>
#include
<sys/types.h>
#include
<wait.h>
#include
<wait.h>
#include
<spawn.h>
#include
<spawn.h>
...
@@ -92,7 +93,7 @@ __mkdir(const char *dir)
...
@@ -92,7 +93,7 @@ __mkdir(const char *dir)
/* Exec an other program wthout any argument */
/* Exec an other program wthout any argument */
static
pid_t
___klkt_pid
=
0
;
static
pid_t
___klkt_pid
=
0
;
__attribute__
((
con
structor
))
static
inline
void
__attribute__
((
de
structor
))
static
inline
void
___kill_klkt
(
void
)
___kill_klkt
(
void
)
{
{
RETURN_UNLESS
(
___kill_klkt
,
"No klkt child process to wait for"
,
NOTHING
)
RETURN_UNLESS
(
___kill_klkt
,
"No klkt child process to wait for"
,
NOTHING
)
...
@@ -133,6 +134,11 @@ __launch_klkt(void)
...
@@ -133,6 +134,11 @@ __launch_klkt(void)
static
const
char
*
basename_appimage_arch
=
"klkt.AppImage"
;
static
const
char
*
basename_appimage_arch
=
"klkt.AppImage"
;
static
const
char
*
basename_appimage_no_arch
=
"klkt-"
LKT_ARCH
".AppImage"
;
static
const
char
*
basename_appimage_no_arch
=
"klkt-"
LKT_ARCH
".AppImage"
;
posix_spawn_file_actions_t
action
;
posix_spawn_file_actions_init
(
&
action
);
posix_spawn_file_actions_addopen
(
&
action
,
STDOUT_FILENO
,
"/dev/null"
,
O_RDONLY
,
0
);
posix_spawn_file_actions_addopen
(
&
action
,
STDERR_FILENO
,
"/dev/null"
,
O_RDONLY
,
0
);
if
(
appimage
==
NULL
)
{
if
(
appimage
==
NULL
)
{
/* No AppImage */
/* No AppImage */
if
(
read_self_exe
(
exe_path
,
LKT_LINE_MAX
))
{
if
(
read_self_exe
(
exe_path
,
LKT_LINE_MAX
))
{
...
@@ -150,31 +156,29 @@ __launch_klkt(void)
...
@@ -150,31 +156,29 @@ __launch_klkt(void)
/* Normal try */
/* Normal try */
errno
=
0
;
errno
=
0
;
safe_snprintf
(
try_name
,
LKT_LINE_MAX
,
"%s/klkt"
,
current_dir
);
safe_snprintf
(
try_name
,
LKT_LINE_MAX
,
"%s/klkt"
,
current_dir
);
if
(
posix_spawn
(
&
___klkt_pid
,
try_name
,
NULL
,
NULL
,
args
,
environ
)
==
0
)
{
LOG_DEBUG
(
"GENERAL"
,
"Try to launch klkt with file %s"
,
try_name
);
LOG_INFO
(
"GENERAL"
,
"Klkt launched with pid %ld with from %s"
,
___klkt_pid
,
try_name
);
GOTO_UNLESS
(
posix_spawn
(
&
___klkt_pid
,
try_name
,
&
action
,
NULL
,
args
,
environ
),
"Klkt launched!"
,
end
);
return
;
}
/* AppImage try */
/* AppImage try */
safe_snprintf
(
try_name
,
LKT_LINE_MAX
,
"%s/klkt-"
LKT_ARCH
".AppImage"
,
current_dir
);
safe_snprintf
(
try_name
,
LKT_LINE_MAX
,
"%s/klkt-"
LKT_ARCH
".AppImage"
,
current_dir
);
errno
=
0
;
errno
=
0
;
args
[
0
]
=
(
char
*
)
basename_appimage_arch
;
args
[
0
]
=
(
char
*
)
basename_appimage_arch
;
if
(
posix_spawn
(
&
___klkt_pid
,
try_name
,
NULL
,
NULL
,
args
,
environ
)
==
0
)
{
LOG_DEBUG
(
"GENERAL"
,
"Try to launch klkt with file %s"
,
try_name
);
LOG_INFO
(
"GENERAL"
,
"Klkt launched with pid %ld with from %s"
,
___klkt_pid
,
try_name
);
GOTO_UNLESS
(
posix_spawn
(
&
___klkt_pid
,
try_name
,
&
action
,
NULL
,
args
,
environ
),
"Klkt launched!"
,
end
);
return
;
}
safe_snprintf
(
try_name
,
LKT_LINE_MAX
,
"%s/klkt.AppImage"
,
current_dir
);
safe_snprintf
(
try_name
,
LKT_LINE_MAX
,
"%s/klkt.AppImage"
,
current_dir
);
errno
=
0
;
errno
=
0
;
args
[
0
]
=
(
char
*
)
basename_appimage_no_arch
;
args
[
0
]
=
(
char
*
)
basename_appimage_no_arch
;
if
(
posix_spawn
(
&
___klkt_pid
,
try_name
,
NULL
,
NULL
,
args
,
environ
)
==
0
)
{
LOG_DEBUG
(
"GENERAL"
,
"Try to launch klkt with file %s"
,
try_name
);
LOG_INFO
(
"GENERAL"
,
"Klkt launched with pid %ld with from %s"
,
___klkt_pid
,
try_name
);
GOTO_UNLESS
(
posix_spawn
(
&
___klkt_pid
,
try_name
,
&
action
,
NULL
,
args
,
environ
),
"Klkt launched!"
,
end
);
return
;
}
/* Oupsi */
/* Oupsi */
LOG_ERROR
(
"GENERAL"
,
"Failed to spawn klkt (%s): %s"
,
try_name
,
strerror
(
errno
));
LOG_ERROR
(
"GENERAL"
,
"Failed to spawn klkt (%s): %s"
,
try_name
,
strerror
(
errno
));
___klkt_pid
=
0
;
/* posix_spawnp may have modified it even in case of failure */
___klkt_pid
=
0
;
/* posix_spawnp may have modified it even in case of failure */
end:
LOG_INFO
(
"GENERAL"
,
"Klkt launched with pid %ld"
,
___klkt_pid
,
try_name
);
posix_spawn_file_actions_destroy
(
&
action
);
}
}
int
int
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter