Skip to content

Handle relative paths correctly #33

Closed

Description

@yiding

If I say watchman watch . from some small subdirectory, watchman hangs, persumably because it interpreted the . to mean a different directory to what I expected and is crawling some giant folder somewhere like / or ~.

It would be nice to have relative paths warn, or just handle them correctly.

Activity

  1. wez commented on Apr 10, 2014

    @wez
    Contributor

    The path is resolved by the watchman server which has a working dir set to /, and you're right in that you don't really want to be watching everything.

    Handling relative paths in all cases means replicating the server logic in the client, and then it wouldn't behave in quite the same way as clients that are using the JSON or BSER protocols.

    I'm leaning towards a simpler sanity check: if the path doesn't start with a / when it reaches the server, we can return an error and ask you pass in the absolute path.

    In the meantime, I'd recommend using watchman watch $PWD instead

  2. wez commented on Apr 10, 2014

    @wez
    Contributor

    (we can also disallow watching / while we're in there)

  3. added a commit that references this issue on Apr 20, 2014
  4. wez commented on Apr 20, 2014

    @wez
    Contributor
    wez@wez-mbp master ~/fb/watchman-pure
    9:54 $ ./watchman watch .
    {
        "version": "2.9.6",
        "error": "unable to resolve root .: path \".\" must be absolute"
    }
    wez@wez-mbp master ~/fb/watchman-pure
    9:54 $ ./watchman watch $PWD
    {
        "version": "2.9.6",
        "watch": "/Users/wez/fb/watchman-pure"
    }
    

    I'm calling this "good enough" for now. I have some hacking lined up for the CLI that might address making it smarter, we'll see how far I get.

  5. schickling commented on Apr 29, 2014

    @schickling

    👍 for relative paths

  6. added a commit that references this issue on May 11, 2014
  7. wez commented on May 13, 2014

    @wez
    Contributor

    b8832cc is in the tree, and I get this when I run what's in master:

    $ ./watchman watch .
    {
        "version": "2.9.8",
        "watch": "/Users/wez/fb/watchman"
    }
    

    so this is done. Are you trying something and it isn't working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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