-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbin.js
executable file
·37 lines (31 loc) · 866 Bytes
/
bin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env node
var net = require('net')
, repl = require('repl')
, assert = require('assert')
, wd = require('./main');
var connections = 0;
var startRepl = function() {
var r = repl.start('(wd): ');
r.context.assert = assert;
r.context.wd = wd;
r.context.help = function() {
console.log("WD - Shell.");
console.log("Access the webdriver object via the object: 'wd'");
};
var server = net.createServer(function (socket) {
connections += 1;
socket.setTimeout(5*60*1000, function() {
socket.destroy();
});
repl.start("(wd): ", socket);
}).listen(process.platform === "win32" ?
"\\\\.\\pipe\\node-repl-sock-" + process.pid :
"/tmp/node-repl-sock-" + process.pid);
r.on('exit', function () {
server.close();
process.exit();
});
};
if (process.argv[2] === "shell") {
startRepl();
}