Skip to content

CWD with CD pattern failure #50

@konard

Description

@konard

🐛 Bug Description

Using `cd` command patterns with command-stream fails to maintain the changed directory context, or the current working directory (CWD) behavior is inconsistent.

🔴 Impact

  • Directory navigation doesn't work as expected
  • Scripts that depend on `cd` fail
  • Build processes that change directories break

📝 Problem Details

```javascript
// ❌ Doesn't maintain directory change
await $`cd /some/directory`;
await $`pwd`; // Still in original directory

// Each command runs in a new shell context
```

🔧 Workaround

Chain commands in single execution:
```javascript
// ✅ Commands in same shell context
await $`cd /some/directory && pwd`;

// Or use Node.js process.chdir()
process.chdir('/some/directory');
```

🎯 Root Cause

Each command-stream invocation creates a new shell, losing directory context between commands.

🔗 References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions