Skip to content

Commit 784d04e

Browse files
committed
builder-utils: Set LANGUAGE to avoid AppStream output localisation
Parsing the output prefix fails otherwise.
1 parent 29df15f commit 784d04e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/builder-utils.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,11 +1852,14 @@ appstream_has_version (int major,
18521852
as_micro == 0)
18531853
{
18541854
const char * argv[] = { "appstreamcli", "--version", NULL };
1855+
g_autoptr(GSubprocessLauncher) launcher = NULL;
18551856
g_autoptr(GSubprocess) subp = NULL;
18561857
g_autofree char *out = NULL;
18571858
g_auto(GStrv) lines = NULL;
18581859

1859-
subp = g_subprocess_newv (argv, G_SUBPROCESS_FLAGS_STDOUT_PIPE, NULL);
1860+
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE);
1861+
g_subprocess_launcher_setenv (launcher, "LANGUAGE", "C", TRUE);
1862+
subp = g_subprocess_launcher_spawnv (launcher, argv, NULL);
18601863
g_subprocess_communicate_utf8 (subp, NULL, NULL, &out, NULL, NULL);
18611864

18621865
lines = g_strsplit (out, "\n", -1);

tests/libtest.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ appstream_has_version () {
316316

317317
maj=0; min=0; mic=0
318318

319-
out=$(appstreamcli --version 2>/dev/null) || return 1
319+
out=$(LANGUAGE=C appstreamcli --version 2>/dev/null) || return 1
320320

321321
while IFS= read -r line; do
322322
case "$line" in

0 commit comments

Comments
 (0)