summaryrefslogtreecommitdiff
path: root/cli/js/write_file.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/js/write_file.ts')
-rw-r--r--cli/js/write_file.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/cli/js/write_file.ts b/cli/js/write_file.ts
index 5227bfece..ed64141d2 100644
--- a/cli/js/write_file.ts
+++ b/cli/js/write_file.ts
@@ -3,6 +3,7 @@ import { stat, statSync } from "./ops/fs/stat.ts";
import { open, openSync } from "./files.ts";
import { chmod, chmodSync } from "./ops/fs/chmod.ts";
import { writeAll, writeAllSync } from "./buffer.ts";
+import { build } from "./build.ts";
export interface WriteFileOptions {
append?: boolean;
@@ -26,7 +27,11 @@ export function writeFileSync(
const openMode = !!options.append ? "a" : "w";
const file = openSync(path, openMode);
- if (options.mode !== undefined && options.mode !== null) {
+ if (
+ options.mode !== undefined &&
+ options.mode !== null &&
+ build.os !== "win"
+ ) {
chmodSync(path, options.mode);
}
@@ -50,7 +55,11 @@ export async function writeFile(
const openMode = !!options.append ? "a" : "w";
const file = await open(path, openMode);
- if (options.mode !== undefined && options.mode !== null) {
+ if (
+ options.mode !== undefined &&
+ options.mode !== null &&
+ build.os !== "win"
+ ) {
await chmod(path, options.mode);
}