janet-lang / janet

A dynamic language and bytecode vm
https://janet-lang.org
MIT License
3.38k stars 217 forks source link

How to switch off spork/sh/copy message? #1449

Closed fnaj77 closed 1 month ago

fnaj77 commented 1 month ago

Hi to all, I casually noticed that with the latest janet[1], this call:

(spork/sh/copy "foo.txt" "bar.txt")

writes the following text on standard output after copying the file:

copying foo.txt to bar.txt...

Is there a way to prevent the message from being printed?

I didn't find anything about it in the official documentation[2] and JanetDocs doesn't have a page about it[3].

Its companion function: (spork/sh/copy-file "foo.txt" "bar.txt")

doesn't have the same problem.

As always, many thanks for the amazing work on Janet!

[1] 1.34.0-2f0c789e linux/x64/gcc, compiled from source [2] https://janet-lang.org/api/spork/index.html#spork/sh/copy [3] https://janetdocs.com/spork/sh/copy

bakpakin commented 1 month ago

So, for various windows reasons, we use xcopy to copy files there instead of manually copy files, which is where the output comes from. On windows, there were certain file permissions and metadata that we needed to copy for jpm (the package manager / build tool) to install things properly. This function got lifted in spork as a general purpose utility, but the extra output was left in. In most cases, there probably isn't any need to use xcopy, but we should probably redirect output to nul on windows to make the process cleaner.

fnaj77 commented 1 month ago

Hi @bakpakin, thank you for using your time to reply to me.

If I understand correctly, it comes from using xcopy on Windows, but why do I see it on a linux machine too? Anyway, I can also use spork/sh/copy-file which doesn't have the same problem, at least until the message is silenced.

Thank you again for your work on janet!