docker: tearDown method

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2023-03-02 15:25:29 +01:00
parent ac9d9d9a1b
commit 70390c899b
4 changed files with 81 additions and 9 deletions

View File

@@ -74,12 +74,14 @@ export class Util {
return true;
}
public static async powershellCommand(script: string, params: Record<string, string>) {
public static async powershellCommand(script: string, params?: Record<string, string>) {
const powershellPath: string = await io.which('powershell', true);
const escapedScript = script.replace(/'/g, "''").replace(/"|\n|\r/g, '');
const escapedParams: string[] = [];
for (const key in params) {
escapedParams.push(`-${key} '${params[key].replace(/'/g, "''").replace(/"|\n|\r/g, '')}'`);
if (params) {
for (const key in params) {
escapedParams.push(`-${key} '${params[key].replace(/'/g, "''").replace(/"|\n|\r/g, '')}'`);
}
}
return {
command: `"${powershellPath}"`,