From 9c78f775776bc5be58ea65156f713da0f41c8296 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Wed, 20 Mar 2013 16:22:43 -0700 Subject: [PATCH] Fix args for embedded repo When we generate a binary with an embedded repo, we add various args (-vRepo.Authoritative etc) to the end of the command line. But the argument "--" is taken to mean "pass the rest of the args to the script". So if you use "--" on such a binary, it gets rather badly broken. Reorder the args so that the inserted ones come first. --- hphp/hhvm/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hphp/hhvm/main.cpp b/hphp/hhvm/main.cpp index 137cc0b86..74362a65c 100644 --- a/hphp/hhvm/main.cpp +++ b/hphp/hhvm/main.cpp @@ -31,10 +31,13 @@ int main(int argc, char** argv) { return HPHP::execute_program(argc, argv); } std::vector args; - args.insert(args.begin(), argv, argv + argc); + args.push_back(argv[0]); args.push_back("-vRepo.Authoritative=true"); args.push_back("-vRepo.Local.Mode=r-"); repo = "-vRepo.Local.Path=" + repo; args.push_back(const_cast(repo.c_str())); + if (argc > 1) { + args.insert(args.end(), argv + 1, argv + argc); + } return HPHP::execute_program(args.size(), &args[0]); }