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

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

Issue 2370573002: DevTools: enable front-end to use external services for additional capabilities. (Closed)
Patch Set: split into parts 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
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() { }
8
9 Terminal.prototype = {
10 setNotify: function(notify)
11 {
12 this._notify = notify;
13 },
14
15 init: function(params)
16 {
17 this._term = pty.spawn(process.platform === "win32" ? "cmd.exe" : "bash" , [], {
18 name: "xterm-color",
19 cols: params.cols || 80,
20 rows: params.rows || 24,
21 cwd: process.env.PWD,
22 env: process.env
23 });
24
25 this._term.on("data", data => {
26 if (this._notify)
27 this._notify("data", { data: data });
28 });
29 return Promise.resolve({});
30 },
31
32 resize: function(params)
33 {
34 this._term.resize(params.cols, params.rows);
35 return Promise.resolve({});
36 },
37
38 write: function(params)
39 {
40 this._term.write(params.data);
41 return Promise.resolve({});
42 },
43
44 dispose: function(params)
45 {
46 this._notify = null;
47 if (this._term)
48 process.kill(this._term.pid);
49 return Promise.resolve({});
50 },
51 }
52
53 exports.Terminal = Terminal;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698