Skip to content
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

When starting code recently after closing : error exec: code not found #8

Closed
rrichardson opened this issue Jun 2, 2021 · 5 comments

Comments

@rrichardson
Copy link

Thanks for taking the time to thoroughly make Code in Toolbox a pleasant experience. I've had no problems with the script other than this one:

If I start code after closing it (which I sometimes do to reset an LSP, or I installed an extension that requires restart)

I get this :

/var/home/me/my-project-dir: line 3: exec: code: not found

If I wait 60 or so seconds, not sure on the exact time, then it works just fine.
I haven't been able to trace the line of code that originates the error, it seems to come from nowhere :)
I wonder if this is related to : flathub/com.visualstudio.code#210
Where the script is finding the previous IPC channel that hasn't yet closed. After the channel is cleaned up, then the script launches "from scratch" again. Just a guess.

@Steve229
Copy link

Same issue here... but waiting didn't help at all. I killed my terminal(s) and waited about 15 minutes - still got the error message. After logging out and back in again it worked fine.

But when it's working it's great - thanks for the effort to get this working!

@anthr76
Copy link

anthr76 commented Sep 11, 2021

toolbox-vscode/code.sh

Lines 385 to 417 in 273ea0e

# Different invocations of the Flatpak have separate $XDG_DATA_DIR;
# to actually open a window in the existing process requires
# hackery.
# https://github.com/flathub/com.visualstudio.code/issues/210
verbose "Checking for running Visual Studio Code Flatpak"
existing=$($flatpak ps --columns=instance,application | sort -nr | \
while read -r instance application ; do
if [ "$application" == "com.visualstudio.code" ] ; then
echo "$instance"
break
fi
done)
if [ "$existing" = "" ] ; then
verbose "No running Visual Studio Code Flatpak, will use 'flatpak run'"
$verbose && set -x
$flatpak run com.visualstudio.code \
--remote attached-container+"$container_name_encoded" "${new_args[@]}"
else
verbose "Found running Visual Studio Code Flatpak, will use 'flatpak enter'"
# shellcheck disable=SC1004,SC2016
script='
cd $0
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus \
DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket \
exec "$@"
'
$verbose && set -x
$flatpak enter "$existing" sh -c "$script" "$PWD" code \
--remote attached-container+"$container_name_encoded" "${new_args[@]}"
fi

@owtaylor
Copy link
Owner

owtaylor commented Nov 5, 2021

I've merged a change that should help here - #12 - if people could test that would be appreciated!

@anthr76
Copy link

anthr76 commented Nov 5, 2021

@owtaylor I just performed a quick test.. Executing code . a few times in different directories and I cannot reproduce this anymore! 🎉

Incredibly nice work.

@owtaylor
Copy link
Owner

owtaylor commented Nov 5, 2021

@owtaylor I just performed a quick test.. Executing code . a few times in different directories and I cannot reproduce this anymore! tada

Thanks for the testing!

@owtaylor owtaylor closed this as completed Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants