Skip to content

Confused with dune exec ./bin/main.exe, why file not exists, but still can execute #5895

@ghost

Description

Expected Behavior

The file should exists

Actual Behavior

$ dune exec ./bin/main.exe
Hello, World!
 $ ls -l ./bin/main.exe
ls: ./bin/main.exe: No such file or directory
 $ cat bin/main.ml
let () = print_endline "Hello, World!"

Reproduction

$ dune init proj helloworld
Success: initialized project component named helloworld
$ cd helloworld
We can build our program with dune build:

$ dune build
When we change our program, we can type dune build again to make a new executable. To run the program, we can use:

$ dune exec ./bin/main.exe
Hello, World!


 $ ls -l ./bin/main.exe
ls: ./bin/main.exe: No such file or directory

Specifications

  • Version of dune (output of dune --version):
    $ dune --version
    3.2.0

  • Version of ocaml (output of ocamlc --version)
    $ ocamlc --version
    4.12.0

  • Operating system (distribution and version):
    MacOS 12 Intel cpu

Additional information

I can not understand, the file ./bin/main.exe not exists, why we can run dune exec ./bin/main.exe

and i got the output?

Why, i can not read why from the document, document not tell us.

very strange.

For every document we know with unix/linux.

There should be a file exists, then we can exec that file/programm.

If the file not exists in the directory/path, we will get the file not found error message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions