Skip to content

Commit 3b5a839

Browse files
committed
Allow user interaction with gpg2 process
This commit makes sure the parent process's stdin pipe can be used by the gpg2 signing process, allowing user interaction such as passing passphrases etc.
1 parent b119bbe commit 3b5a839

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/appimagetool.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,14 @@ main (int argc, char *argv[])
12151215
fprintf(stderr, "\n");
12161216
}
12171217

1218-
GSubprocess* sign_proc = g_subprocess_newv((const gchar* const*) sign_process_argv->pdata, G_SUBPROCESS_FLAGS_STDIN_PIPE, &error);
1218+
// this should allow the user to, e.g., reply to a prompt
1219+
GSubprocessFlags flags = G_SUBPROCESS_FLAGS_STDIN_INHERIT;
1220+
1221+
if (sign_passphrase) {
1222+
flags = G_SUBPROCESS_FLAGS_STDIN_PIPE;
1223+
}
1224+
1225+
GSubprocess* sign_proc = g_subprocess_newv((const gchar* const*) sign_process_argv->pdata, flags, &error);
12191226

12201227
if (sign_proc == NULL) {
12211228
fprintf(stderr, "ERROR: failed to create gpg process: %s\n", error->message);
@@ -1225,6 +1232,8 @@ main (int argc, char *argv[])
12251232
if (sign_passphrase) {
12261233
bool success = g_subprocess_communicate_utf8(sign_proc, sign_passphrase, NULL, NULL, NULL, &error);
12271234

1235+
free(sign_passphrase_buffer);
1236+
12281237
if (!success) {
12291238
fprintf(stderr, "ERROR: failed to pass passphrase to gpg process: %s\n", error->message);
12301239
g_object_unref(sign_proc);

0 commit comments

Comments
 (0)