diff --git a/snap/local/glib-spawn-no-close.patch b/snap/local/glib-spawn-no-close.patch deleted file mode 100644 index b12a650c8ca387f20b4c36cafb24e33f0f2d31e6..0000000000000000000000000000000000000000 --- a/snap/local/glib-spawn-no-close.patch +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# Disable closing file descriptors because the snap confinement has some -# that it doesn't want us to close -diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp -index a3896d41b6..88c6b826d5 100644 ---- a/src/extension/implementation/script.cpp -+++ b/src/extension/implementation/script.cpp -@@ -796,7 +796,7 @@ int Script::execute (const std::list &in_command, - try { - Glib::spawn_async_with_pipes(working_directory, // working directory - argv, // arg v -- static_cast(0), // no flags -+ Glib::SPAWN_LEAVE_DESCRIPTORS_OPEN, - sigc::slot(), - &_pid, // Pid - nullptr, // STDIN diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e78c9c754ba3c6590b9964ab9d2a65070e89b693..8381ca3fad40c1b64bf1b3c80407bda58cfd4b09 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -124,7 +124,6 @@ parts: - -lib/inkscape/*.a - -*canberra*so* # We don't have sound permissions anyway - -usr/lib/*/gtk-2.0 -# TODO removed patch -p1 --batch --directory=$SNAPCRAFT_PART_SRC --input=$SNAPCRAFT_PART_SRC/snap/local/glib-spawn-no-close.patch override-build: | sed -i.bak -e 's|Icon=${INKSCAPE_ICONPATH}|Icon=${SNAP}/share/inkscape/branding/inkscape.svg|g' $SNAPCRAFT_PART_SRC/org.inkscape.Inkscape.desktop.template snapcraftctl build diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp index d6b0e337a368c253797031d1c784008ddf8452c5..e51d2e7e8c5e95097aab599563f62aac6cd1accb 100644 --- a/src/extension/implementation/script.cpp +++ b/src/extension/implementation/script.cpp @@ -754,14 +754,21 @@ int Script::execute (const std::list &in_command, int stdout_pipe, stderr_pipe; try { + auto spawn_flags = Glib::SpawnFlags::DEFAULT; + if (Glib::getenv("SNAP") != "") { + // If we are running within the Linux "snap" package format, + // we need different spawn flags to avoid that Inkscape hangs when + // starting an extension. + spawn_flags = Glib::SpawnFlags::LEAVE_DESCRIPTORS_OPEN; + } Glib::spawn_async_with_pipes(working_directory, // working directory - argv, // arg v - static_cast(0), // no flags - sigc::slot(), - &_pid, // Pid - nullptr, // STDIN - &stdout_pipe, // STDOUT - &stderr_pipe); // STDERR + argv, // arg v + spawn_flags, // spawn flags + sigc::slot(), + &_pid, // Pid + nullptr, // STDIN + &stdout_pipe, // STDOUT + &stderr_pipe); // STDERR } catch (Glib::Error const &e) { g_critical("Script::execute(): failed to execute program '%s'.\n\tReason: %s", program.c_str(), e.what()); return 0;