-
Notifications
You must be signed in to change notification settings - Fork 391
Expand file tree
/
Copy pathkill.ts
More file actions
43 lines (39 loc) · 966 Bytes
/
kill.ts
File metadata and controls
43 lines (39 loc) · 966 Bytes
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
38
39
40
41
42
43
import { getLogger } from 'pinus-logger';
let logger = getLogger(__filename);
import * as util from '../util';
import { consts } from '../consts';
import * as cliff from 'cliff';
import { ICommand, AgentCommand } from '../command';
import { ReadLine } from 'readline';
import { AdminClient } from 'pinus-admin';
export default function (opts:object)
{
return new Command(opts);
};
export let commandId = 'kill';
export let helpCommand = 'help kill';
export class Command implements ICommand
{
constructor(opts:object)
{
}
handle(agent: AgentCommand, comd: string, argv: string, msg: {[key:string]: string}, rl: ReadLine, client: AdminClient): void
{
rl.question(consts.KILL_QUESTION_INFO, function (answer)
{
if (answer === 'yes')
{
client.request(consts.CONSOLE_MODULE, {
signal: "kill"
}, function (err:Error, data:any)
{
if (err) console.log(err);
rl.prompt();
});
} else
{
rl.prompt();
}
});
}
}