Closed rebolek closed 2 years ago
Thank you @rebolek for your effort and submission!
Please give me some time to add red
support to the "build system". I've found out that it's unsupported on my darwin arch.
Epic!
@rebolek How do I run this thing? :) Assuming that I have rebol/red installed?
I've experimented with this. Without luck. ;|
docker run -ti --rm -v $PWD:/tmp/app --entrypoint nix-shell nixos/nix -p red \
--run "red -r /tmp/app/src/red/compress.red"
@otobrglez your command should be "red /tmp/app/src/red/compress.red"
without -r
. Anyway, if I try it, it still complains it can’t find the file. It has something to do with Docker path mapping. I’m not an expert on Docker but I try to find a solution and let you know.
@rebolek can you please explain this cryptic error message to me please?
$ docker run -ti -v $PWD:/app --entrypoint /bin/bash kskarthik/redlang:0.6.4 /app/src/red/run-red.sh
+ cd /app/src/red
+ red compress.red
Compiling compression library...
Compiling Red console...
*** Syntax Error: invalid value at "^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@"
*** Where: do
*** Stack: load
This is me trying to use kskarthik/redlang:0.6.4 docker image with Red with a bash script to overcome this issue.
The run-red.sh
looks like this
#!/usr/bin/env bash
set -ex
cd /app/src/red && red compress.red
Thank you!
Perhaps you could find useful this repo as an example: https://github.com/exercism/red-test-runner/
@otobrglez ^@
is zero, so it's somehow reading an empty file.
@hiiamboris wrote: "This looks like a problem with 32-bit file system driver. I got smth like that on WSL2 when reading files from NTFS partitions."
@otobrglez
Ok, I've got it, removing -t
is enough, the script works then, here's the proper command (assuming you are in the repo's root):
docker run -ti --rm -v $PWD:/tmp/app --entrypoint nix-shell nixos/nix -p red \
--run "red -r /tmp/app/src/red/compress.red"
However, there is no output from the script as it only throws an error if the assertion failed and outputs nothing if there's no error.
This is a solution written in Red language. It’s a one-liner but split into commented multiple lines for easier understanding. As a bonus, I added decompression also.