blender/release/freedesktop/snap/blender-wrapper
Gaktan 279413f7cf Linux: fix snap package spawning multiple process
Found this issue on godot (https://github.com/godotengine/godot/issues/97429).

We expect to create a single process when launching blender. But if the user uses a snap package instead of the standalone version, then two processes are spawned when launching Blender. This causes issues when trying to kill the process, and only the `blender-wrapper` process is killed. Not the second spawned process.

Using exec should play nicer with snap.

Tested locally, it seems to work as expected but I would love someone else to test my change and validate that only one process is created.

Co-authored-by: Gaktan <Gaktan@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/155643
2026-04-08 11:23:10 +02:00

21 lines
713 B
Bash
Executable file

#!/bin/sh
# Disable ALSA and OSS as they are not available, and trying to initialize them
# breaks sound in other apps. Use PulseAudio instead.
export ALSOFT_DRIVERS=-oss,-alsa,
export SDL_AUDIODRIVER=pulseaudio
# Make PulseAudio socket available inside the snap-specific $XDG_RUNTIME_DIR
# This is adapted from https://github.com/ubuntu/snapcraft-desktop-helpers,
# in common/desktop-exports.
mkdir -p $XDG_RUNTIME_DIR -m 700
if [ -n "$XDG_RUNTIME_DIR" ]; then
pulsenative="pulse/native"
pulseaudio_sockpath="$XDG_RUNTIME_DIR/../$pulsenative"
if [ -S "$pulseaudio_sockpath" ]; then
export PULSE_SERVER="unix:${pulseaudio_sockpath}"
fi
fi
# Run Blender
exec $SNAP/blender-launcher "$@"