summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingbo (Max) Wang <maxwyb@gmail.com>2019-04-23 06:47:29 -0700
committerRyan Dahl <ry@tinyclouds.org>2019-04-23 09:47:29 -0400
commitda64fba046e4f324bff62d71ae74906fa6e3421f (patch)
tree1fdecc68f9d6644f8c245cad91eaebd3fb5531e0
parentd9408017541ffe6c86f4904973c22f829ade1ac4 (diff)
symlink: Ignore type parameter on non-Windows platforms (#2185)
Fixes #2169
-rw-r--r--js/symlink.ts4
-rw-r--r--js/symlink_test.ts7
2 files changed, 8 insertions, 3 deletions
diff --git a/js/symlink.ts b/js/symlink.ts
index 9230e9fa0..28bf6c859 100644
--- a/js/symlink.ts
+++ b/js/symlink.ts
@@ -3,14 +3,14 @@ import * as msg from "gen/cli/msg_generated";
import * as flatbuffers from "./flatbuffers";
import * as dispatch from "./dispatch";
import * as util from "./util";
+import { platform } from "./build";
function req(
oldname: string,
newname: string,
type?: string
): [flatbuffers.Builder, msg.Any, flatbuffers.Offset] {
- // TODO Use type for Windows.
- if (type) {
+ if (platform.os === "win" && type) {
return util.notImplemented();
}
const builder = flatbuffers.createBuilder();
diff --git a/js/symlink_test.ts b/js/symlink_test.ts
index ae9b0c8cc..2ce666949 100644
--- a/js/symlink_test.ts
+++ b/js/symlink_test.ts
@@ -14,6 +14,7 @@ testPerm({ read: true, write: true }, function symlinkSyncSuccess(): void {
errOnWindows = e;
}
if (errOnWindows) {
+ assertEquals(Deno.platform.os, "win");
assertEquals(errOnWindows.kind, Deno.ErrorKind.Other);
assertEquals(errOnWindows.message, "Not implemented");
} else {
@@ -36,6 +37,7 @@ test(function symlinkSyncPerm(): void {
});
// Just for now, until we implement symlink for Windows.
+// Symlink with type should succeed on other platforms with type ignored
testPerm({ write: true }, function symlinkSyncNotImplemented(): void {
let err;
try {
@@ -43,7 +45,10 @@ testPerm({ write: true }, function symlinkSyncNotImplemented(): void {
} catch (e) {
err = e;
}
- assertEquals(err.message, "Not implemented");
+ if (err) {
+ assertEquals(Deno.platform.os, "win");
+ assertEquals(err.message, "Not implemented");
+ }
});
testPerm({ read: true, write: true }, async function symlinkSuccess(): Promise<