Commit Graph

115 Commits

Author SHA1 Message Date
Ben Newman
8a578e954b Fix race condition where shell listens too early.
Fixes #4109.
2015-04-02 15:28:46 -04:00
David Greenspan
8557d054dc Merge branch 'master' into devel 2015-03-31 16:36:15 -07:00
David Glasser
da87051f34 meteor shell should preserve global _
2443d832 (in 1.0.4) ensures that the repl doesn't overwrite `_`, but it
replaces the server's global `_` with shell-server's `_`.  This changes
appears to preserve it.

Fixes #4010.
2015-03-26 14:53:47 -07:00
Slava Kim
fa6d536c80 Always set the path to the node binary when running npm from Meteor 2015-03-24 17:29:02 -07:00
Slava Kim
5dc8ea5ffb Always convert \r\n and \r sequences to \n on file reading in tool
Fixes https://github.com/meteor/windows-preview/issues/104
2015-03-20 17:35:55 -07:00
Slava Kim
d8e22d9404 Consistently parse end-of-line characters as "\n" on all platforms for the meteor shell history file.
Fixes the bug where the history would be parsed as one big blob on Windows,
because it is always written with "\n" but parsed with "\r\n" on Windows and
"\n" on Unixy platforms.
2015-03-20 17:00:34 -07:00
David Glasser
8c48196f4d Remove unnecessary requires from mini-files.js
and add a comment making it clear that we are NOT using this file for
the concurrency-related changes, just for cross-platform normalization.
2015-02-09 11:40:44 -08:00
Ben Newman
4ad860ca47 Move tools/shell/server.js to tools/server/shell-server.js.
Since this file ends up getting copied into the server bundle, along with
files like boot.js, it makes sense to keep it with those files.

Renamed tools/shell/client.js to tools/shell-client.js for symmetry.
2015-02-09 11:42:49 -05:00
Ben Newman
19080bd53d Split server/shell.js into shell/server.js and shell/client.js.
Note that shell/server.js is copied into the bundle as shell-server.js,
like before, however now it contains none of the extraneous code that
belongs in shell/client.js.

The original reason server and client code were combined in a single file
was to share helper functions and configuration variables (e.g.
getInfoFile and EXITING_MESSAGE). Now, shell/client.js requires
shell/server.js to access those shared exports.
2015-02-06 14:33:19 -05:00
David Glasser
505a77ecad Update other places that mention the Node version 2015-02-05 22:40:43 -08:00
Sashko Stubailo
3cd883bda4 Merge branch 'windows-r' into devel
Conflicts:
	meteor
	tools/tropohouse.js
2015-02-05 20:28:09 -08:00
Slava Kim
152b9576a2 Fix the use of paths in Npm.require on Windows 2015-02-04 19:11:27 -08:00
Ben Newman
dd4bbc28c0 Avoid writing to meteor shell socket after client has disconnected.
Summary: Fixes #3595.

Test Plan:
See that the reproduction given in
https://github.com/meteor/meteor/issues/3595 no longer crashes the server.

Reviewers: glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D23
2015-02-04 19:39:41 -05:00
Ben Newman
5091b87c59 Use a port instead of a socket file for meteor shell.
Summary:
This eliminates a whole class of problems relating to socket files (such
as the limit on the length of their names), and potentially makes it
easier to implement `meteor shell` on other platforms, such as Windows.

Fixes #3591.

Test Plan:
Use `meteor shell` and verify that it still works as before, especially
when started before/after/during server startup, and when the server is
killed while multiple shell clients are connected.

Reviewers: Slava, dgreensp, stubailo, glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D22
2015-02-04 19:39:40 -05:00
Ben Newman
75f86e16e4 Silently disable shell access if socket filename is too long.
Summary:
Note that an explanation will be printed to the console for clients
attempting to connect via `meteor shell`, but nothing will be printed to
the server console.

Fixes #3591.

Test Plan:
Artificially lower the limit and verify that the server starts as usual,
but that shell clients exit with a warning.

Reviewers: Slava, dgreensp, stubailo, glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D21
2015-02-04 19:39:40 -05:00
Ben Newman
27cf3f550b Refactor server/shell.js into classes, and add simple authentication.
Summary:
Requiring a key that is only discoverable via the file system will allow
us to safely listen for connections on a port instead of a socket file.

Test Plan:
Use `meteor shell` and verify that it still works as before, especially
when started before/after/during server startup, and when the server is
killed while multiple shell clients are connected.

Reviewers: Slava, dgreensp, stubailo, glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D20
2015-02-04 19:39:36 -05:00
Sashko Stubailo
a75cae93ed Merge branch 'devel' into windows-r
Conflicts:
	packages/package-version-parser/package.js
	tools/bundler.js
	tools/server/boot.js
2015-02-04 15:50:31 -08:00
Slava Kim
d574e5e1e2 Fix Npm.require to correctly resolve absolute paths 2015-02-04 14:19:54 -08:00
Sashko Stubailo
b3cb7a49f7 Merge branch 'devel' into windows-cr
Conflicts:
	packages/application-configuration/package.js
	packages/ctl-helper/package.js
	packages/ctl/package.js
	packages/dev-bundle-fetcher/package.js
	packages/follower-livedata/package.js
	packages/jquery/package.js
	packages/star-translate/package.js
	packages/test-in-browser/package.js
	tools/bundler.js
	tools/compiler.js
	tools/package-client.js
	tools/package-source.js
	tools/package-version-parser.js
	tools/server/boot.js
2015-02-04 13:56:54 -08:00
Sashko Stubailo
cbe5db4282 Improve comment and add convertToWindowsPath in Meteor tool link 2015-02-02 13:23:27 -08:00
Sashko Stubailo
35d4223fcc Be careful about paths in boot.js 2015-01-30 15:44:56 -08:00
Sashko Stubailo
472cef6a64 Move part of files into mini-files.js 2015-01-30 15:44:51 -08:00
Ben Newman
26ebc82198 Use error.code instead of .errno in server/shell.js. 2015-01-29 14:41:00 -05:00
Ben Newman
d75f1889d7 Retry listening for meteor shell connections on EADDRINUSE errors. 2015-01-29 12:24:35 -05:00
David Glasser
d4e1f80bf7 Add a comment 2015-01-23 16:43:52 -08:00
gsuess
2bd8eae66b Npm.require load correct submodule 2015-01-23 16:33:10 -08:00
gsuess
be11590dbe Fix Npm.require() package sub-modules. 2015-01-23 16:33:10 -08:00
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
Slava Kim
296d765cca Package.js:api.addFiles and Assets.get* accept both type of paths 2015-01-20 22:04:24 -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
096df9d62d Refactor parent pid check; drop --keepalive
This commit moves parent pid process from the webapp package to the boot
script. This means that daemonized apps without webapp will also exit
when the runner exits, if run from the runner. (For example, several
self-tests such as 'autoupdate' no longer leak node processes.) This is
controlled via the $METEOR_PARENT_PID environment variable instead of
from command line arguments, in order to make fewer assumptions about
how Meteor apps process arguments.

This also drops the old --keepalive support (which already has stopped
being used by the dev mode runner or any MDG deployment platforms).
Neither --parent-pid nor --keepalive were documented beforehand, and
--keepalive was already deprecated before 1.0.

These flags used to also incidentally trigger printing the LISTENING
line; this is now controlled by $METEOR_PRINT_ON_LISTEN.

Fixes #3315.
2015-01-05 15:48:32 -08:00
David Glasser
beaf067540 Fix typo in meteor shell output
Fixes #3326.
2014-12-19 14:08:26 -08:00
Ben Newman
f9b7fa19a6 Avoid unnecessary dynamic requires.
CommonJS module identifiers are specified always to use forward slashes,
even on Windows, so there's no value in using path.join or files.pathJoin
to construct module identifiers.
2014-12-16 19:24:58 -05:00
David Glasser
76745d27b2 Document use of undocumented runInThisContext flag
Accidentally removed in 2d827e74f.

Fixes #3200.
2014-12-05 12:19:54 -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
David Glasser
c2a4134d97 Update Node to 0.10.33 from 0.10.29
Our npm patch is not yet in a Node 0.10 release (it's in npm 2.1.0).
2014-10-30 15:12:28 -07: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
Sashko Stubailo
857b380416 Remove duplicate part from the docs, move JSDoc comment for Npm.require 2014-09-16 13:52:33 -07:00
David Glasser
98b2885e85 Revert "Upgrade Node to 0.10.30. Fix npm bug again."
This reverts commit 56ff54b085.
2014-08-15 07:21:24 -07:00
David Glasser
56ff54b085 Upgrade Node to 0.10.30. Fix npm bug again. 2014-08-14 10:15:47 -07:00
David Glasser
5a85e2f24c Merge branch 'devel' into packaging
Conflicts:
	tools/bundler.js
	tools/tests/login.js
	tools/unipackage.js
2014-06-23 14:48:21 -07:00
David Glasser
4bec4877e3 after startup, Meteor.startup(c) should call c now
This was the client behavior and is now the server behavior as well.

Fixes #2239.
2014-06-18 17:05:05 -07:00
David Glasser
f2501469b9 Allow apps with no packages 2014-06-17 09:40:59 -07:00