Skip to content

Instantly share code, notes, and snippets.

@benschweizer
Last active September 22, 2023 15:37
Show Gist options
  • Save benschweizer/0978d4d93ac8103429519cfd4c69491b to your computer and use it in GitHub Desktop.
Save benschweizer/0978d4d93ac8103429519cfd4c69491b to your computer and use it in GitHub Desktop.
open file in vscode remote ssh from a different terminal
#!/bin/bash
set -e
set -o pipefail
PID=$(lsof -w -c node | grep vscode-ipc | sed -e 's/ */ /g' | cut -d " " -f2 | head -1)
NODE=$(readlink -f /proc/$PID/exe)
CODE=$(dirname $NODE)/bin/remote-cli/code
SOCK=$(lsof -w -c node | grep vscode-ipc | sed -e 's/ */ /g' | cut -d " " -f9 | head -1)
export VSCODE_IPC_HOOK_CLI=$SOCK
$CODE $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment