Skip to content

Bug: get_venv_bin_dir outputs relative paths, breaking Python execution after cd commands in scripts #72

@Adithyakp86

Description

@Adithyakp86

Issue 4

**Title:** `Bug: get_venv_bin_dir outputs relative paths, breaking Python execution after cd commands in scripts`

### Bug Description
When running a script defined in `project.toml` that changes directories (e.g., `test = "cd tests && python run_tests.py"`), the execution fails. Because `ppmm` sets the execution `PATH` to a relative directory (`./venv/Scripts/` or `./venv/bin/`), the OS attempts to resolve [python](cci:1://file:///d:/OSCG/ygufds/ppmm/src/utils.rs:28:0-30:1) from the new working directory after the `cd` command. Since [./venv](cci:1://file:///d:/OSCG/ygufds/ppmm/src/utils.rs:97:0-113:1) does not exist inside `./tests`, the command fails to find Python.

### Location
- [src/utils.rs](cci:7://file:///d:/OSCG/ygufds/ppmm/src/utils.rs:0:0-0:0) inside the [get_venv_bin_dir](cci:1://file:///d:/OSCG/ygufds/ppmm/src/utils.rs:36:0-38:1) function (line 37).

### Technical Details
Currently, [get_venv_bin_dir](cci:1://file:///d:/OSCG/ygufds/ppmm/src/utils.rs:36:0-38:1) computes a path strictly relative to the root execution context:
```rust
pub fn get_venv_bin_dir(venv_root: &str) -> String {
    format!("./{}/{}/", venv_root, VENV_BIN_DIR)
}


Proposed Solution
Resolve the computed virtual environment path to an absolute path (using std::fs::canonicalize or std::env::current_dir) before injecting it into the PATH environment variable. This ensures the environment path remains correct no matter what directory the shell scripts navigate to.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions