igor-petruk / scriptisto

A language-agnostic "shebang interpreter" that enables you to write scripts in compiled languages.
Apache License 2.0
943 stars 24 forks source link

Docker-Rust template fails #44

Closed albocc closed 3 months ago

albocc commented 7 months ago

Expected Behavior

Simply running the example template for docker-rust should succeed.

Actual Behavior

Running the example yields in an error.

cp: can't stat '/vol/./target/x86_64-unknown-linux-musl/release/script': No such file or directory

Error: Build failed for "/Users/albocc/test/baz.rs"

Caused by:
    Command cd "/Users/albocc/Library/Caches/scriptisto/bin/Users/albocc/test/baz.rs" && "docker" "run" "-t" "--rm" "-u" "501" "-v" "scriptisto-baz.rs-59a389cedb23bfb1783c7e9877873f89-src:/vol" "-v" "/Users/albocc/Library/Caches/scriptisto/bin/Users/albocc/test/baz.rs:/src" "busybox" "sh" "-c" "mkdir -p $(dirname /src/./target/x86_64-unknown-linux-musl/release/script) && cp -rf /vol/./target/x86_64-unknown-linux-musl/release/script /src/./target/x86_64-unknown-linux-musl/release/script" failed. Exit code: 1.

Steps to Reproduce the Problem

  1. cargo install scriptisto
  2. scriptisto new docker-rust > baz.rs
  3. chmod +x baz.rs
  4. ./baz.rs

Specifications

igor-petruk commented 3 months ago

I am pretty sure it is because the triplet is hardcoded here https://github.com/igor-petruk/scriptisto/blob/2d0cbbb342894b3cc8bf4d22ce7c6fdb25fe7ff2/data/templates/docker-rust.rs#L6

On macOS you might have something else. I mean, docker is in Linux host, but maybe the arch is not x86_64. I will try to test this on M1 macOS machine asap,

Meanwhile you can browse /Users/albocc/Library/Caches/scriptisto/bin/Users/albocc/test/baz.rs to see what directory does it make and the change your own template via scriptisto template edit docker-rust