aboutsummaryrefslogtreecommitdiff
path: root/src/server/ActionUtilities.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/ActionUtilities.ts')
-rw-r--r--src/server/ActionUtilities.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server/ActionUtilities.ts b/src/server/ActionUtilities.ts
index 9bdc4ed93..2e62443c6 100644
--- a/src/server/ActionUtilities.ts
+++ b/src/server/ActionUtilities.ts
@@ -1,4 +1,4 @@
-import { readFile, writeFile, exists, mkdir, unlink } from 'fs';
+import { readFile, writeFile, exists, mkdir, unlink, createWriteStream } from 'fs';
import { ExecOptions } from 'shelljs';
import { exec } from 'child_process';
import * as path from 'path';
@@ -10,6 +10,11 @@ export function pathFromRoot(relative: string) {
return path.resolve(projectRoot, relative);
}
+export async function fileDescriptorFromStream(path: string) {
+ const logStream = createWriteStream(path);
+ return new Promise<number>(resolve => logStream.on("open", resolve));
+}
+
export const command_line = (command: string, fromDirectory?: string) => {
return new Promise<string>((resolve, reject) => {
const options: ExecOptions = {};
@@ -54,7 +59,7 @@ export async function log_execution<T>({ startMessage, endMessage, action, color
} catch (e) {
error = e;
} finally {
- log_helper(`${typeof endMessage === "string" ? endMessage : endMessage({ result, error })}.`, resolvedColor);
+ log_helper(typeof endMessage === "string" ? endMessage : endMessage({ result, error }), resolvedColor);
}
return result;
}