Skip to content

Commit

Permalink
Quote the path passed to hh_server
Browse files Browse the repository at this point in the history
Summary: When hh_client spawns a server, quote the path so that paths with spaces in the
name are correctly handled.

Fixes facebook#4310

Closes facebook#4321

Reviewed By: @​svcscm

Differential Revision: D1701186

Pulled By: @int3
  • Loading branch information
simonwelsh authored and hhvm-bot committed Nov 27, 2014
1 parent 2a6f6ce commit 57f69f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions hphp/hack/src/client/clientStart.ml
Expand Up @@ -51,8 +51,8 @@ let start_server env =
"")
| None -> "" in
let hh_server = Printf.sprintf "%s -d %s %s"
(get_hhserver())
(Path.string_of_path env.root)
(Filename.quote (get_hhserver()))
(Filename.quote (Path.string_of_path env.root))
server_options in
Printf.fprintf stderr "Server launched with the following command:\n\t%s\n%!"
hh_server;
Expand Down
7 changes: 1 addition & 6 deletions hphp/hack/src/utils/shell.ml
Expand Up @@ -8,11 +8,6 @@
*
*)

(** This is probably not fully safe. It'll do a reasonable job of escaping
silly things like spaces, quotes and so on but there are probably ways
to break it. *)
let escape_string_for_shell str =
let escaped = Str.global_replace (Str.regexp "'") "'\"'\"'" str in
"'" ^ escaped ^ "'"
let escape_string_for_shell = Filename.quote

let escape_spaces str = Str.global_replace (Str.regexp " ") "\\ " str

0 comments on commit 57f69f3

Please sign in to comment.