Skip to content

Commit

Permalink
Add js docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva committed Nov 28, 2023
1 parent 9df908b commit c35f74b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main/utils/scanUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,14 @@ export class ScanUtils {
return exec.execSync(command, { cwd: cwd, maxBuffer: ScanUtils.SPAWN_PROCESS_BUFFER_SIZE, env: env });
}

/**
* Executes a command asynchronously and returns the output.
* @param command - The command to execute.
* @param checkCancel - A function to check if cancellation is requested.
* @param cwd - The current working directory for the command execution.
* @param env - Optional environment variables for the command execution.
* @returns Command output or rejects with an error.
*/
public static async executeCmdAsync(
command: string,
checkCancel: () => void,
Expand Down Expand Up @@ -189,7 +197,13 @@ export class ScanUtils {
});
}

public static cancelProcess(childProcess: exec.ChildProcess, checkCancel: () => void, reject: (reason?: any) => void): void {
/**
* Cancels the child process if cancellation is requested.
* @param childProcess - The child process to be cancelled.
* @param checkCancel - A function to check if cancellation is requested.
* @param reject - A function to reject the promise.
*/
private static cancelProcess(childProcess: exec.ChildProcess, checkCancel: () => void, reject: (reason?: any) => void): void {
try {
checkCancel();
} catch (error) {
Expand Down

0 comments on commit c35f74b

Please sign in to comment.