aboutsummaryrefslogtreecommitdiff
path: root/src/server/ActionUtilities.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-12-09 10:16:58 -0500
committerbob <bcz@cs.brown.edu>2019-12-09 10:16:58 -0500
commit2b5002cb19fd896426df2a26b981b99fb88dc119 (patch)
treed929ea2c4f761146367043c65125f7cd3f904535 /src/server/ActionUtilities.ts
parente5ca273b70c2c41f953ad2a534afabdb313f3e99 (diff)
parentcfaf02757f5aebd2ccce0bbef8b6f5e232932693 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/server/ActionUtilities.ts')
-rw-r--r--src/server/ActionUtilities.ts10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/server/ActionUtilities.ts b/src/server/ActionUtilities.ts
index 4fe7374d1..94008e171 100644
--- a/src/server/ActionUtilities.ts
+++ b/src/server/ActionUtilities.ts
@@ -9,21 +9,21 @@ export const command_line = (command: string, fromDirectory?: string) => {
return new Promise<string>((resolve, reject) => {
const options: ExecOptions = {};
if (fromDirectory) {
- options.cwd = path.join(__dirname, fromDirectory);
+ options.cwd = path.resolve(__dirname, fromDirectory);
}
exec(command, options, (err, stdout) => err ? reject(err) : resolve(stdout));
});
};
export const read_text_file = (relativePath: string) => {
- const target = path.join(__dirname, relativePath);
+ const target = path.resolve(__dirname, relativePath);
return new Promise<string>((resolve, reject) => {
fs.readFile(target, (err, data) => err ? reject(err) : resolve(data.toString()));
});
};
export const write_text_file = (relativePath: string, contents: any) => {
- const target = path.join(__dirname, relativePath);
+ const target = path.resolve(__dirname, relativePath);
return new Promise<void>((resolve, reject) => {
fs.writeFile(target, contents, (err) => err ? reject(err) : resolve());
});
@@ -73,7 +73,3 @@ export async function Prune(rootDirectory: string): Promise<boolean> {
}
export const Destroy = (mediaPath: string) => new Promise<boolean>(resolve => fs.unlink(mediaPath, error => resolve(error === null)));
-
-export function addBeforeExitHandler(handler: NodeJS.BeforeExitListener) {
- process.on("beforeExit", handler);
-}