bun icon indicating copy to clipboard operation
bun copied to clipboard

Bun fs#appendFile throws error.

Open LiberaTeMetuMortis opened this issue 3 years ago • 0 comments

Version

0.1.7

Platform

Linux metumortis-monster 5.15.0-43-generic #46~20.04.1-Ubuntu SMP Thu Jul 14 15:20:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

What steps will reproduce the bug?

You can basically run the given commands:

mkdir Example && cd Example && touch example.txt && bun init -y && echo 'import * as fs from "fs/promises"\nawait fs.appendFile("./example.txt", "Hi!")' > index.ts && bun run index.ts

How often does it reproduce? Is there a required condition?

Everytime I try to use fs.appendFile

What is the expected behavior?

It should append the given input to the given file.

What do you see instead?

9 | var obj = { 10 | [fsFunction.name]: function (resolve, reject, args) { 11 | var result; 12 | try { 13 | 14 | result = fsFunction.apply(fs, args); ^ EPERM: Operation not permitted syscall: "write" errno: -1

  at appendFileSync (node:fs/promises:14:17)
  at node:fs/promises:31:6
  at node:fs/promises:30:11
  at /media/metumortis/D/Yedek/Development/Bun/Example/Example/index.ts:2:6

Additional information

No response

LiberaTeMetuMortis avatar Aug 07 '22 21:08 LiberaTeMetuMortis