Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dune exec for adverbial commands (time, afl, ...) #3171

Open
emillon opened this issue Feb 20, 2020 · 6 comments
Open

dune exec for adverbial commands (time, afl, ...) #3171

emillon opened this issue Feb 20, 2020 · 6 comments

Comments

@emillon
Copy link
Collaborator

emillon commented Feb 20, 2020

Hi,

dune exec can be used to build an executable and run it, with optional arguments. But it's not possible to execute in a way where it's not the main command.

For example there is no way to say build x.exe and run time ./x.exe or afl-fuzz ./x.exe @@ (I've heard the term adverbial commands because time or afl-fuzz describe "how" ./x.exe is executed).

The feature itself looks straightforward but the concrete syntax is not. Let me suggest the following:

  • dune exec time ./x.exe (we scan all arguments and look for things that look like executables)
  • dune exec time %{bin:./x.exe} (we reuse the pform from dune files)

A workaround is to define an alias with a custom action based on (run), but this does not work for interactive use.

Thanks!

cc @let-def

@ghost
Copy link

ghost commented Feb 20, 2020

What about specifying which argument is the command via an argument? For instance:

dune exec --prog-at 1 time ./x.exe

@Khady
Copy link
Contributor

Khady commented Feb 21, 2020

maybe a different command, as it is done in esy?

x Execute command as if the package is installed

@bobot
Copy link
Collaborator

bobot commented Feb 24, 2020

I agree with @Khady more generally many more things than just the binary are needed. So If you want dune exec to keep up to date the local installation something like: dune exec -p pkg1 -p pkg2 ... which will be the same than (deps (package pkg1) (package pkg2)) in rule is needed. Perhaps dune exec -P for building all the packages.

@emillon
Copy link
Collaborator Author

emillon commented Feb 24, 2020

I think that's useful but it seems that it's a slightly different feature. In my use case, the executables are not public for example.

@bobot
Copy link
Collaborator

bobot commented Feb 24, 2020

Would dune build @all && dune exec works for you? So does a generic dune exec -b @all ... would be okay?

@emillon
Copy link
Collaborator Author

emillon commented Aug 1, 2022

Duplicate of #2691

@emillon emillon marked this as a duplicate of #2691 Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants