Skip to content
New issue

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

Shell not found in module #2575

Open
jneuendorf-i4h opened this issue Jan 14, 2025 · 2 comments
Open

Shell not found in module #2575

jneuendorf-i4h opened this issue Jan 14, 2025 · 2 comments

Comments

@jneuendorf-i4h
Copy link

jneuendorf-i4h commented Jan 14, 2025

Description

When I use set working-directory in a child module and the value contains an expression, the following error occurs:

error: Backtick could not be run because just could not find the shell:
No such file or directory (os error 2)

The expression itself seems to be irrelevant, as I tried both set working-directory := '{{ "." }}' and set working-directory := '{{ justfile_directory() }}'. However, it works without the expression, i.e. set working-directory := '.'

I need this for Terraform/Ansible where relative paths are important for correct file lookups but at the same time I need to ensure that each just module has its own settings (i.e. to avoid env var clashes).

Example

.
├── justfile
└── modules
    └── a.just
# ./justfile
USERNAME := `whoami`

mod a 'modules/a.just'

task:
    echo {{ USERNAME }}



# ./modules/a.just
set working-directory := '{{ "." }}'

USERNAME := `whoami`

task:
    echo {{ USERNAME }}

Versions

Just: 1.38.0
OS: macOS 15.2


Update: The same goes for using the attribute [working-directory: '{{ BASE_DIR }}/path'].


PS: I just read about Werk which seems to draw a lot of inspiration from just. Maybe some improvements there could be valuable features for just as well.

@laniakea64
Copy link
Contributor

Interpolations are not expanded in strings.

See #11 and #2309

@jneuendorf-i4h
Copy link
Author

Is there any recommended workaround? Would using a bash shebang recipe with a cd to the desired working directory work? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants