-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flatpak-run invocations don't share IPC socket #210
Comments
From my flatpak run --branch=stable --arch=x86_64 --command=code --file-forwarding com.visualstudio.code --reuse-window @@ %F @@ EDIT: There is also a Hope that helps! |
Do you think that helps? When I run |
Actually this can be achieved manually as follows:
You should now see two vscode windows while To re-use the container you will still need to enter it first (similar to |
@antis81 - to explain further - a lot of applications work this way - they only start a single process even if run multiple times. (The second process talks to the first process over some IPC mechanism, passes along command line parameters, and then exits.) These are typically called "single instance applications". When the IPC mechanism is D-Bus, this "just works" for Flatpaks. But Visual Studio Code implements this mechanism with a socket, which it puts in $XDG_RUNTIME_DIR when that's set. And every invocation of 'flatpak run' gets a separate $XDG_RUNTIME_DIR. I put a couple of ideas for working around this in the original post. |
This is what I'm saying. :) |
@alexlarsson Please I have a question on running a sandbox'ed process as "single-instance" application. I Wrote a little wrapper script (sh) that resembles the For reference here is the snippet: #!/bin/sh
set -e
APPLICATION='com.visualstudio.code'
COMMAND=/app/bin/code
ARGS=$@
FLATPAK=/usr/bin/flatpak
flatpakInstanceId() {
# determines the flatpak instance id from 'flatpak ps' command
# param $1: flatpak application name (see $APPLICATION)
local application=$1
local ps_lines=`$FLATPAK ps --columns='instance:f,application:f'`
local app_line=`echo $ps_lines |grep "$application"`
# output instance id is in first column
local inst_id=`echo $app_line |awk '{split($0,a); print a[1];}'`
echo $inst_id
}
main() {
local INST_ID=$(flatpakInstanceId $APPLICATION)
if [ "$INST_ID" != '' ]; then
echo "entering $APPLICATION instance $INST_ID"
$FLATPAK enter $INST_ID $COMMAND $ARGS
else
echo "starting vscode sandbox"
$FLATPAK run --branch=stable --arch=x86_64 --command=$COMMAND $APPLICATION $ARGS
fi
}
main # start here |
@antis81 - maybe you are running into flatpak/flatpak#3832 - that's been fixed upstream, but not in all distros. See: https://github.com/owtaylor/toolbox-vscode/blob/main/code.sh#L410 For how I worked around it. |
Visual Studio Code is designed to run as a single process within the session: if you run
code /someproject
and thencode --new-window /some/other/project
the idea is that the second invocation opens<dir>/vscode-<hash>-<version>.sock
and asks the initial process to open the second window, where:But with the Flatpak, every invocation of
flatpak-run com.visualstudio.code
gets a new temporary $XDG_RUNTIME_DIR created.This makes
alias code="flatpak run com.visualstudio.code"
not work very well.I don't have a great idea for a solution:
flatpak ps
and, if an existing process is found,flatpak enter
- butflatpak enter
is more a development facility then something to use in production.~/.var/app/com.visualstudio.code/config/Code/
, which might work OK. I don't think sharing the user data dir on a NFS home directory would work well anyways.flatpak run
invocations?The text was updated successfully, but these errors were encountered: