Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: third_party/WebKit/Source/devtools/services/terminal.js

Issue 2370573002: DevTools: enable front-end to use external services for additional capabilities. (Closed)
Patch Set: review addressed Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/services/package.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var pty = require("pty.js");
6
7 function Terminal(notify)
8 {
9 this._notify = notify;
10 }
11
12 Terminal.prototype = {
13 init: function(params)
14 {
15 this._term = pty.spawn(process.platform === "win32" ? "cmd.exe" : "bash" , [], {
16 name: "xterm-color",
17 cols: params.cols || 80,
18 rows: params.rows || 24,
19 cwd: process.env.PWD,
20 env: process.env
21 });
22
23 this._term.on("data", data => {
24 if (this._notify)
25 this._notify("data", { data: data });
26 });
27 return Promise.resolve({});
28 },
29
30 resize: function(params)
31 {
32 if (this._term)
33 this._term.resize(params.cols, params.rows);
34 return Promise.resolve({});
35 },
36
37 write: function(params)
38 {
39 this._term.write(params.data);
40 return Promise.resolve({});
41 },
42
43 dispose: function(params)
44 {
45 this._notify = null;
46 if (this._term)
47 process.kill(this._term.pid);
48 return Promise.resolve({});
49 },
50 }
51
52 exports.Terminal = Terminal;
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/services/package.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698