Skip to content

Commit

Permalink
fix: Makefile bin/sh compatibility (wsl) (#452)
Browse files Browse the repository at this point in the history
### Problem 
Was facing this error while running ``` make env``` in wsl

![image](https://github.com/user-attachments/assets/003094f5-e46e-413e-bd84-2fb263c95b16)
 

```
if [[ -z "$$VIRTUAL_ENV" ]]; then \
        echo "No virtual environment is active"; \
```
The original code used the [[ ... ]] syntax for checking if the
VIRTUAL_ENV variable was empty, but [[ ... ]] is a Bash-specific feature
and wasn't being interpreted correctly in the Makefile's default shell
(/bin/sh).

### Change:

Replaced [[ ... ]] with [ ... ] to ensure compatibility with /bin/sh.
The -z flag is used to check if the VIRTUAL_ENV variable is either empty
or undefined (i.e., a zero-length or null string).
  • Loading branch information
palash018 authored Aug 18, 2024
1 parent 945fd43 commit 61a9506
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ format-and-check:

.PHONY: env
env: clean
if [[ "$$VIRTUAL_ENV" == "" ]];\
if [ -z "$$VIRTUAL_ENV"];\
then\
pipenv --rm;\
pipenv --clear;\
Expand Down

0 comments on commit 61a9506

Please sign in to comment.