-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathcleanup-service.d.ts
73 lines (65 loc) · 2.83 KB
/
cleanup-service.d.ts
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* Descibes the cleanup service which allows scheduling cleanup actions
* The actions will be executed once CLI process exits.
*/
interface ICleanupService extends IShouldDispose, IDisposable {
/**
* Add new action to be executed when CLI process exits.
* @param {ISpawnCommandInfo} commandInfo The command that should be executed, including command and args.
* @returns {Promise<void>}
*/
addCleanupCommand(commandInfo: ISpawnCommandInfo): Promise<void>;
/**
* Remove action to be executed when CLI process exits.
* NOTE: The action should be added in the action list by calling `addCleanupAction` first.
* @param {ISpawnCommandInfo} commandInfo The command that should be removed from cleanup execution, including command and args.
* @returns {Promise<void>}
*/
removeCleanupCommand(commandInfo: ISpawnCommandInfo): Promise<void>
/**
* Sets the file in which the cleanup process will write its logs.
* This method must be called before starting the cleanup process, i.e. when CLI is initialized.
* @param {string} filePath Path to file where the logs will be written. The logs are appended to the passed file.
* @returns {void}
*/
setCleanupLogFile(filePath: string): void;
/**
* Adds file/dir to be deleted once CLI process exits.
* @param {string} filePath Path to file/directory to be deleted.
* @returns {Promise<void>}
*/
addCleanupDeleteAction(filePath: string): Promise<void>;
/**
* Removes file/dir from the list of files to be deleted once CLI process exits.
* NOTE: The file should be first added with `addCleanupDeleteAction`
* @param {string} filePath Path to file/directory to be removed from the list of files to be deleted.
* @returns {Promise<void>}
*/
removeCleanupDeleteAction(filePath: string): Promise<void>;
/**
* Adds JS file to be required and executed during cleanup.
* NOTE: The JS file will be required in a new child process, so you can pass timeout for the execution.
* In the child process you can use all injected dependencies of CLI.
* @param {IJSCommand} jsCommand Information about the JS file to be required and the data that should be passed to it.
* @returns {Promise<void>}
*/
addCleanupJS(jsCommand: IJSCommand): Promise<void>;
/**
* Removes JS file to be required and executed during cleanup.
* @param {IJSCommand} filePath jsCommand Information about the JS file to be required and the data that should not be passed to it.
* @returns {Promise<void>}
*/
removeCleanupJS(jsCommand: IJSCommand): Promise<void>;
/**
* Adds a kill action for the process
* @param pid the pid of the process to be killed
* @returns {Promise<void>}
*/
addKillProcess(pid: string): Promise<void>;
/**
* Removes the kill action for the process
* @param pid the pid of the process to be killed
* @returns {Promise<void>}
*/
removeKillProcess(pid: string): Promise<void>;
}