Commit Graph

12 Commits

Author SHA1 Message Date
Sashko Stubailo
f462bcac9c Add comment explaining named pipe naming 2015-01-20 22:34:12 -08:00
Sashko Stubailo
06d6126e7e Use named pipes on Windows instead of socket files 2015-01-20 22:34:06 -08:00
Ben Newman
1aba3a8e7a Eliminate the need for getAppDir in tools/server/shell.js.
Summary:
Instead of expecting the child process to figure out where the
`.meteor/local` directory is, we now tell it explicitly via the
`METEOR_SHELL_DIR` environment variable.

Fixes #3437.

Test Plan:
Run `meteor shell` in a separate terminal and see that it still connects
to an app running from the same app directory.

Reviewers: glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D11
2015-01-20 13:56:57 -05:00
Ben Newman
3f98fe900a Allow redefinition of shell _ variable. 2015-01-16 11:33:13 -05:00
Ben Newman
2443d83226 Reenable tab-completion of global variable names in meteor shell.
Summary:
Before this commit you could type `Meteor.is` in a `meteor shell` session
and then tab to see a list of possible completions (e.g.
`Meteor.isClient`, `Meteor.isServer`), but typing a prefix of a global
variable name like `Mete` followed by tab has been broken ever since we
stopped using the global object as the REPL context:
https://github.com/meteor/meteor/commit/7c7e52f2d2

The reason for that commit was to prevent the REPL from overwriting the
global `_` variable (which most Meteor developers expect to be bound to
`require("underscore")`): https://github.com/meteor/meteor/3227

This commit solves #3227 by making `repl.context._` a read-only property
that is permanently "bound" to underscore.  As a bonus, we now intercept
assignments to `_` and store those values as `repl.context.__`, so you
still have access to the last result in the shell via `__`.

Test Plan:
Run `meteor shell`, evaluate a few expressions, and see that (1) global
variables can be tab-completed, (2) `_` remains bound to underscore, and
(3) `__` gets bound to the result of the evaluated expressions.

Reviewers: avital, stubailo, glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D12
2015-01-15 13:49:57 -05:00
David Glasser
beaf067540 Fix typo in meteor shell output
Fixes #3326.
2014-12-19 14:08:26 -08:00
Graeme Pyle
e63ac7c071 Prevent REPL from stomping global._ (Underscore library)
The return value of last command is stored in global._ if the REPL is set to use the global context. So Underscore is no longer available to Meteor server code as global._

See http://stackoverflow.com/questions/10973968/underscore-doesnt-work-in-coffeescripts-console
2014-12-04 16:23:58 +02:00
Ben Newman
b45bc06fff Catch shell socket server errors so they don't break self-test. 2014-10-21 17:49:16 -04:00
Ben Newman
a776715dae Never print a stack trace when unlinkSocketFile fails. 2014-10-20 20:09:24 -04:00
Ben Newman
2926fdafab Tweak wording of meteor shell banner message. 2014-10-20 15:49:34 -04:00
Ben Newman
17138b0805 Remove an inaccurate comment and add a potentially helpful comment. 2014-10-20 15:05:44 -04:00
Ben Newman
830acf651c Implement a meteor shell command.
Summary:
Invoking `meteor shell` starts an interactive REPL for evaluating server-side code.

Shell commands are evaluated in the server process, so the shell's input and output have to be piped through a socket from/to the parent process that runs the `meteor shell` command. This separation accounts for most of the complexity of this diff, but the end result is pretty seamless: tab completion, history, ctlr-c and ctrl-d, etc. all work as expected.

Task: https://app.asana.com/0/15750483766338/16576093991355

Test Plan: Run `meteor run` in one terminal and `meteor shell` in another, evaluate some commands, and verify that the commands seem to be running the context of the server process. Also check tab completion and history, and ensure that the server is running simultaneously with the shell.

Reviewers: dgreenspan, avital, slava, emily, nim, sashko

CC: sashko

Differential Revision: https://phabricator.meteor.com/D837
2014-10-20 14:44:09 -04:00