Skip to content
Permalink
Browse files

Use stream wrappers in FileUtil::runRelative

Summary: In CLI server mode preludes need to be searched for in the context of the client process, as if they're only available visible from the client they should still be loadable.

Reviewed By: alexeyt

Differential Revision: D13892792

fbshipit-source-id: d3e2ac5c6776ac131ef94d87ac5d3e4bce61891d
  • Loading branch information...
paulbiss authored and hhvm-bot committed Feb 1, 2019
1 parent 43f7eaf commit b7457c8a04dace1b790dad66b710572ca5e7562e
Showing with 6 additions and 1 deletion.
  1. +6 −1 hphp/runtime/base/file-util-defs.h
@@ -23,6 +23,7 @@
#include "hphp/runtime/base/stream-wrapper-registry.h"
#include "hphp/runtime/base/unit-cache.h"
#include "hphp/runtime/ext/std/ext_std_file.h"
#include "hphp/runtime/server/cli-server.h"
#include "hphp/util/logger.h"

#include <string>
@@ -123,7 +124,11 @@ bool runRelative(std::string suffix, String cmd,
auto cwd = resolve_include(
cmd,
currentDir,
[] (const String& f, void*) { return access(f.data(), R_OK) == 0; },
[] (const String& f, void*) {
if (!is_cli_mode()) return access(f.data(), R_OK) == 0;
auto const w = Stream::getWrapperFromURI(f, nullptr, false);
return w->access(f, R_OK) == 0;
},
nullptr
);
if (cwd.isNull()) return false;

0 comments on commit b7457c8

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.