We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br", } import pf.Env import pf.Path main = exePath = Env.exePath! exePathStr = Path.display exePath dbg exePathStr Task.ok {}
Run as roc test.roc
roc test.roc
Output of /home/user/path/to/script/test.roc
/home/user/path/to/script/test.roc
Output of /memfd:roc_file_descriptor (deleted)
/memfd:roc_file_descriptor (deleted)
OS: Archlinux Roc Version: roc nightly pre-release, built from commit 06996d8
Discussed in https://roc.zulipchat.com/#narrow/channel/231634-beginners/topic/basic-cli.20debugging.20Env.2EexePath
Implementation (
basic-cli/crates/roc_host/src/lib.rs
Line 432 in 918c1dc
std::env::current_exe()
/proc/self/exe
roc <file>
Somewhat related is roc-lang/roc#7172 which fixed argv[0] to be set correctly.
argv[0]
Proposed solution is to use argv[0] and ideally combine with Env.cwd for a full absolute path (similar to https://github.com/rust-lang/rust/blob/a8e75c53d0036b5d012cbc0ee5de17f8991fe60c/library/std/src/sys/pal/unix/os.rs#L253) if /proc/self/exe can't be utilized.
Credit to @jwoudenberg and @lukewilliamboswell who did most of the work of putting this information together.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Minimal Reproducible Example:
Run as
roc test.roc
Expected Behavior:
Output of
/home/user/path/to/script/test.roc
Actual Behavior:
Output of
/memfd:roc_file_descriptor (deleted)
Environment:
OS: Archlinux
Roc Version: roc nightly pre-release, built from commit 06996d8
Context
Discussed in https://roc.zulipchat.com/#narrow/channel/231634-beginners/topic/basic-cli.20debugging.20Env.2EexePath
Implementation (
basic-cli/crates/roc_host/src/lib.rs
Line 432 in 918c1dc
std::env::current_exe()
(https://github.com/rust-lang/rust/blob/a8e75c53d0036b5d012cbc0ee5de17f8991fe60c/library/std/src/sys/pal/unix/os.rs#L406) which reads/proc/self/exe
which seems to be invalid when running throughroc <file>
.Somewhat related is roc-lang/roc#7172 which fixed
argv[0]
to be set correctly.Proposed solution is to use
argv[0]
and ideally combine with Env.cwd for a full absolute path (similar to https://github.com/rust-lang/rust/blob/a8e75c53d0036b5d012cbc0ee5de17f8991fe60c/library/std/src/sys/pal/unix/os.rs#L253) if/proc/self/exe
can't be utilized.Credit to @jwoudenberg and @lukewilliamboswell who did most of the work of putting this information together.
The text was updated successfully, but these errors were encountered: