Skip to content

Going to the previous working directory (cd -) does not behave as expected #27

@SuperJappie08

Description

@SuperJappie08

While learning colcon for ROS 2 (as migrating from ROS 1).
I expected to colcon_cd to work like the ROS 1 roscd which allows for the following:

you:~/some_path$ roscd SOME_PACKAGE
you:/path/to/SOME_PACKAGE$ cd - # Return to previous PWD
you:~/some_path$ 

This was allowed since roscd only uses cd just before returning, allowing to use this default mechanism of cd.

However, when using colcon_cd the result is as follows:

you:~/some_path$ colcon_cd SOME_PACKAGE
you:/path/to/SOME_PACKAGE$ cd -
you:/path/to$ # Not where I expected to end up 

As a result of some digging in the source, this is the result of cd-ing multiple times.
Looking at the cd documentation, this could possibly be changed by setting the OLDPWD environment variable, which is used to store the old path.

EDIT: I can make a PR for this if this change is desired.

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