Skip to content

Commit

Permalink
fix argument escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
Yatao Li committed Aug 13, 2019
1 parent 956af0f commit d108f3f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ let (|ForceBool|_|) (x:obj) =
type hashmap<'a, 'b> = System.Collections.Generic.Dictionary<'a, 'b>
let hashmap (xs: seq<'a*'b>) = new hashmap<'a,'b>(xs |> Seq.map (fun (a,b) -> System.Collections.Generic.KeyValuePair(a,b)))

let escapeArgs: string seq -> string seq = Seq.map (fun (x: string) -> if x.Contains(' ') then sprintf "\"%s\"" (x.Replace("\"", "\\\"")) else x)
let join (xs: string seq) = System.String.Join(" ", xs)

let inline (>>=) (x: 'a option) (f: 'a -> 'b option) =
Expand Down
2 changes: 1 addition & 1 deletion neovim/neovim.process.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type Nvim() =
match serveropts with
| StartNew ->
let args = "--embed" :: args
let psi = ProcessStartInfo(prog, join(preargs @ args))
let psi = ProcessStartInfo(prog, (join << escapeArgs) (preargs @ args))
psi.CreateNoWindow <- true
psi.ErrorDialog <- false
psi.RedirectStandardError <- true
Expand Down

0 comments on commit d108f3f

Please sign in to comment.