aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/ScriptingRepl.tsx
diff options
context:
space:
mode:
authorAbdullah Ahmed <abdullah_ahmed@brown.edu>2019-10-05 19:17:11 -0400
committerAbdullah Ahmed <abdullah_ahmed@brown.edu>2019-10-05 19:17:11 -0400
commit57b57b2d82b385ec9aa9d59c0899dc8f48a31223 (patch)
treeea9fef42849fc1341c6da1300bc4e5f25048cb14 /src/client/views/ScriptingRepl.tsx
parenta44e12f4625caca5d75a456f0ba1ab977149ae6e (diff)
parent961cb1566e16edb353975ec436a4445c1cf3db0f (diff)
meged
Diffstat (limited to 'src/client/views/ScriptingRepl.tsx')
-rw-r--r--src/client/views/ScriptingRepl.tsx20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/client/views/ScriptingRepl.tsx b/src/client/views/ScriptingRepl.tsx
index e05195ca0..1eb380e0b 100644
--- a/src/client/views/ScriptingRepl.tsx
+++ b/src/client/views/ScriptingRepl.tsx
@@ -135,19 +135,17 @@ export class ScriptingRepl extends React.Component {
this.commands.push({ command: this.commandString, result: script.errors });
return;
}
- const result = script.run({ args: this.args });
- if (!result.success) {
- this.commands.push({ command: this.commandString, result: result.error.toString() });
- return;
- }
- this.commands.push({ command: this.commandString, result: result.result });
- this.commandsHistory.push(this.commandString);
+ const result = script.run({ args: this.args }, e => this.commands.push({ command: this.commandString, result: e.toString() }));
+ if (result.success) {
+ this.commands.push({ command: this.commandString, result: result.result });
+ this.commandsHistory.push(this.commandString);
- this.maybeScrollToBottom();
+ this.maybeScrollToBottom();
- this.commandString = "";
- this.commandBuffer = "";
- this.historyIndex = -1;
+ this.commandString = "";
+ this.commandBuffer = "";
+ this.historyIndex = -1;
+ }
break;
}
case "ArrowUp": {