Skip to content

regression: echo 'discard' | nim c -r - generates a file '-' ; - should be treated specially #13374

Closed
@timotheecour

Description

@timotheecour

- is special and indicates stdin; it shouldn't be used as output filename. - is bad because it breaks many shell commands, eg: ls - requires quoting.

Example

echo 'echo 0.3' | nim c -r -

Current Output

creates a file ./- in current dir: $PWD/-

Expected Output

in nim 0.18.0 it used to create ./stdinfile; that's better; however IMO it should be hidden inside nimcache.

  • option 1 (simple, and should probably be implemented first)
    create a $nimcache/@stdin & $exeExt

  • option 2
    creates a temporary file $nimcache/$random & $exeExt (random so it won't clobber in case other commands are run simultaneously while a program is executing etc, even though os would make it safe in that case but still)
    the temporary file would auto-delete upon child process exiting

Additional Information

You can always use /dev/stdin instead of -.

(but - should still work)

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