summaryrefslogtreecommitdiff
path: root/cli/tests/056_make_temp_file_write_perm.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-05-29 16:27:43 +0100
committerGitHub <noreply@github.com>2020-05-29 17:27:43 +0200
commit8e39275429c36ff5dfa5d62a80713c5b288fe26a (patch)
tree1d6d2781682bed1c29f81366f08db65c604fef2c /cli/tests/056_make_temp_file_write_perm.ts
parentad6d2a7734aafb4a64837abc6abd1d1d0fb20017 (diff)
fix(cli/permissions): Fix CWD and exec path leaks (#5642)
Diffstat (limited to 'cli/tests/056_make_temp_file_write_perm.ts')
-rw-r--r--cli/tests/056_make_temp_file_write_perm.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/cli/tests/056_make_temp_file_write_perm.ts b/cli/tests/056_make_temp_file_write_perm.ts
index 15aefaff9..c0deda8a2 100644
--- a/cli/tests/056_make_temp_file_write_perm.ts
+++ b/cli/tests/056_make_temp_file_write_perm.ts
@@ -1,8 +1,9 @@
-const path = await Deno.makeTempFile({ dir: "./subdir/" });
-if (path.startsWith(Deno.cwd())) {
+const path = await Deno.makeTempFile({ dir: `subdir` });
+try {
+ if (!path.match(/^subdir[/\\][^/\\]+/)) {
+ throw Error("bad " + path);
+ }
console.log("good", path);
-} else {
- throw Error("bad " + path);
+} finally {
+ await Deno.remove(path);
}
-console.log(path);
-await Deno.remove(path);