Skip to content

Commit

Permalink
getopt: fix tryDaemon fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatao Li committed Sep 9, 2019
1 parent 708d108 commit 0329456
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions getopt.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type Options =
args: string list
program: string
stderrenc: System.Text.Encoding
server: ServerOptions
serveropts: ServerOptions
}

let parseOptions (args: string[]) =
Expand Down Expand Up @@ -88,6 +88,8 @@ let parseOptions (args: string[]) =
["bash"; "-l"; "-c"; sprintf "nvim --embed %s" (args |> escapeArgs |> join)]
elif ssh.IsSome then
[ssh.Value; nvim; "--embed"] @ (List.ofSeq args)
elif tryDaemon then
List.ofSeq args
else
["--embed"] @ (List.ofSeq args)

Expand Down Expand Up @@ -118,7 +120,7 @@ let parseOptions (args: string[]) =
logPatterns = trace_patterns
program = prog
args = args
server = serveropts
serveropts = serveropts
stderrenc = enc
intent = intent
}
Expand Down
5 changes: 3 additions & 2 deletions neovim/neovim.process.fs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type Nvim() =
| Some events -> events
| None -> failwith "events"

member private this.createIO ({ args = args; server = serveropts; program = prog; stderrenc = enc } as opts) =
member private this.createIO ({ args = args; serveropts = serveropts; program = prog; stderrenc = enc } as opts) =
match serveropts with
| StartNew ->
let args = args |> escapeArgs |> join
Expand Down Expand Up @@ -78,7 +78,8 @@ type Nvim() =
pipe.Connect(timeout=50)
StreamChannel pipe
with :? TimeoutException ->
this.createIO {opts with server = StartNew}
// transition from TryDamon to StartNew, add "--embed"
this.createIO {opts with serveropts = StartNew; args = ["--embed"] @ args}

member this.start opts =
match m_io, m_events with
Expand Down

0 comments on commit 0329456

Please sign in to comment.