(e, ret)
| 830 | self.eval(evalCmd, self.context, getREPLResourceName(), finish); |
| 831 | |
| 832 | function finish(e, ret) { |
| 833 | debug('finish', e, ret); |
| 834 | FunctionPrototypeCall(_memory, self, cmd); |
| 835 | |
| 836 | if (e && !self[kBufferedCommandSymbol] && |
| 837 | StringPrototypeStartsWith(StringPrototypeTrim(cmd), 'npm ') && |
| 838 | !(e instanceof Recoverable)) { |
| 839 | self.output.write('npm should be run outside of the ' + |
| 840 | 'Node.js REPL, in your normal shell.\n' + |
| 841 | '(Press Ctrl+D to exit.)\n'); |
| 842 | self.displayPrompt(); |
| 843 | return; |
| 844 | } |
| 845 | |
| 846 | // If error was SyntaxError and not JSON.parse error |
| 847 | // We can start a multiline command |
| 848 | if (e instanceof Recoverable && !sawCtrlD) { |
| 849 | if (self.terminal) { |
| 850 | self[kAddNewLineOnTTY](); |
| 851 | } else { |
| 852 | self[kBufferedCommandSymbol] += cmd + '\n'; |
| 853 | self.displayPrompt(); |
| 854 | } |
| 855 | return; |
| 856 | } |
| 857 | |
| 858 | if (e) { |
| 859 | self._handleError(e.err || e); |
| 860 | self[kLastCommandErrored] = true; |
| 861 | } |
| 862 | |
| 863 | // Clear buffer if no SyntaxErrors |
| 864 | self.clearBufferedCommand(); |
| 865 | sawCtrlD = false; |
| 866 | |
| 867 | // If we got any output - print it (if no error) |
| 868 | if (!e && |
| 869 | // When an invalid REPL command is used, error message is printed |
| 870 | // immediately. We don't have to print anything else. So, only when |
| 871 | // the second argument to this function is there, print it. |
| 872 | arguments.length === 2 && |
| 873 | (!self.ignoreUndefined || ret !== undefined)) { |
| 874 | if (!self.underscoreAssigned) { |
| 875 | self.last = ret; |
| 876 | } |
| 877 | self.output.write(self.writer(ret) + '\n'); |
| 878 | } |
| 879 | |
| 880 | // If the REPL sever hasn't closed display prompt again (unless we already |
| 881 | // did by emitting the 'error' event on the domain instance). |
| 882 | if (!self.closed && !e) { |
| 883 | self[kLastCommandErrored] = false; |
| 884 | self.displayPrompt(); |
| 885 | } |
| 886 | } |
| 887 | }); |
| 888 | |
| 889 | self.on('SIGCONT', function onSigCont() { |
no test coverage detected