-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
38 lines (35 loc) · 1.36 KB
/
index.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
// This implementation is based on type-fest's Opaque, just want to avoid needing the dep
declare const tag: unique symbol
declare type Tagged<Token> = {
readonly [tag]: Token
}
export type StimpackProcess = Tagged<'StimpackProcess'>
/** Arguments that control the launch/injection process. */
export interface LaunchArgs {
/** A path to the executable to launch. */
appPath: string
/** The command-line arguments to pass to the executable. */
args: string
/** The "current directory" the application will be started with. */
currentDir: string
/** A path to the DLL to inject into the process. */
dllPath: string
/** The name of a function exported by the DLL to call after injection. */
dllFunc: string
/** A function that will be called when the injector needs to log information. */
logCallback: (message: string) => void
}
/**
* Launches a process, injects a DLL, and calls the specified function in the DLL.
*
* @returns A promise that resolves with the process object if successful, or rejects with an error
* otherwise.
*/
export function launch(args: LaunchArgs): Promise<StimpackProcess>
/**
* Waits for the given process to exit.
*
* @returns A promise that resolves with the process exit code if successful, or rejects if an error
* occurs while waiting for it to exit.
*/
export function waitForExit(process: StimpackProcess): Promise<number>