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

fix: Strange 255 exit code on Windows #19

Merged
merged 3 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ CATEGORY:
client

OPTIONS:
--use-ports Use ports instead of sockets. Defaults to true on Windows (default: false) [$NVRH_CLIENT_USE_PORTS]
--server-env value [ --server-env value ] Environment variables to set on the remote server
--local-editor {{SOCKET_PATH}} [ --local-editor {{SOCKET_PATH}} ] Local editor to use. {{SOCKET_PATH}} will be replaced with the socket path (default: "nvim", "--server", "{{SOCKET_PATH}}", "--remote-ui")
--help, -h show help
Expand Down
3 changes: 2 additions & 1 deletion src/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ var CliClientOpenCommand = cli.Command{
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "use-ports",
Usage: "Use ports instead of sockets",
Usage: "Use ports instead of sockets. Defaults to true on Windows",
EnvVars: []string{"NVRH_CLIENT_USE_PORTS"},
Value: runtime.GOOS == "windows",
},

&cli.StringSliceFlag{
Expand Down
6 changes: 5 additions & 1 deletion src/ssh_helpers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import (
"fmt"
"log"
"nvrh/src/context"
"os"
"os/exec"
"runtime"
"strings"

"github.com/neovim/go-client/nvim"
Expand All @@ -30,7 +32,9 @@ func StartRemoteNvim(nvrhContext context.NvrhContext) {
fmt.Sprintf("$SHELL -i -c '%s'", nvimCommand),
)

// sshCommand.Stdout = os.Stdout
if runtime.GOOS == "windows" {
sshCommand.Stdout = os.Stdout
}
// sshCommand.Stderr = os.Stderr
Comment on lines +35 to 38
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting either .Stdout or .Stderr worked, I'm going with stdout so no strange errors pop up and potentially worry users.

// sshCommand.Stdin = os.Stdin

Expand Down