aboutsummaryrefslogtreecommitdiff
path: root/src/server/ActionUtilities.ts
diff options
context:
space:
mode:
authorSam Wilkins <samwilkins333@gmail.com>2019-12-11 13:54:28 -0500
committerSam Wilkins <samwilkins333@gmail.com>2019-12-11 13:54:28 -0500
commitae3603e26adb635380d530b84cb9d6f1284066ef (patch)
tree8d2a84489765126c6246281f55f9cf7c3957c5fe /src/server/ActionUtilities.ts
parentad079a088ae9262a4a40a2f0d2a2c5d948140492 (diff)
process factory refactor
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;
}