Skip to content

- not treated as stdin #269

Open
Open
@rdpate

Description

@rdpate

Because File::Next only returns existing files, there's no way to use "-" interpreted as stdin -- it gets filtered out before ack gets to see it (except see notes 1-2 below).

Example:

$ cat file
xbyz
$ ack b. - <file  # bug
$ # expected was to read stdin and find a match
$ touch ./-  # watch what happens
$ ack b. - <file  # as expected, but for wrong reasons, note-1
xbyz
$ ack b. ./-  # as expected, note-2
$

Notes 1-2 show that ack b. - <file is testing ./- for file existance, but reading stdin.

Possible fixes are changing the sort order from that specfied on the command line (so that you can pull out "-" before File::Next sees it), which is undesirable, or changing File::Next (because of possible name sorting, I couldn't see how to do this otherwise), or maybe something much more exotic with how File::Next is invoked (I looked hard at this first).

Tested against http://beyondgrep.com/ack-2.14-single-file on Ubuntu 14.04.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions