mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Ensure that require and module are always set.
I previously had thought that a duplicate call to `setRequireAndModule` encountered in code-path would no longer be necessary after some consolidation in previous steps of this re-factor, but the test failure seen here made it clear what was happening: https://circleci.com/gh/meteor/meteor/12445 Specifically, if a module was imported in a piped command (that is to say, when no TTY is present and the `evaluateAndExit` code-path is taken), as so: echo 'import { Meteor } from "meteor/meteor"' | meteor shell ...the `module` and `require` symbols were not set. Conveniently, this is the environment in effect when the `meteor self-test` suite is ran since they do not have a TTY. This moves the `setAndRequire` from the "interactive-only" function into the general REPL setup and further harmonizes the code.
This commit is contained in:
@@ -222,6 +222,8 @@ class Server {
|
||||
repl.context = global;
|
||||
repl.useGlobal = true;
|
||||
|
||||
setRequireAndModule(repl.context);
|
||||
|
||||
// In order to avoid duplicating code here, specifically the complexities
|
||||
// of catching so-called "Recoverable Errors" (https://git.io/vbvbl),
|
||||
// we will wrap the default eval, run it in a Fiber (via a Promise), and
|
||||
@@ -270,8 +272,6 @@ class Server {
|
||||
configurable: true
|
||||
});
|
||||
|
||||
setRequireAndModule(repl.context);
|
||||
|
||||
// Some improvements to the existing help messages.
|
||||
function addHelp(cmd, helpText) {
|
||||
const info = repl.commands[cmd] || repl.commands["." + cmd];
|
||||
|
||||
Reference in New Issue
Block a user