# improve detection of how to execute binaries on the host · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/f3edff439e2dd8e4055d21507b352141cd5b1718)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: f3edff439e2dd8e4055d21507b352141cd5b1718

Requested commit: f3edff439e2dd8e4055d21507b352141cd5b1718

Commit: f3edff439e2dd8e4055d21507b352141cd5b1718

Tree: 160b6397c84011c008c0a5671bbdbbcf41c4b5fd

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
improve detection of how to execute binaries on the host

`getExternalExecutor` is moved from `std.zig.CrossTarget` to
`std.zig.system.NativeTargetInfo.getExternalExecutor`.

The function also now communicates a bit more information about *why*
the host is unable to execute a binary. The CLI is updated to report
this information in a useful manner.

`getExternalExecutor` is also improved to detect such patterns as:
 * x86_64 is able to execute x86 binaries
 * aarch64 is able to execute arm binaries
 * etc.

Added qemu-hexagon support to `getExternalExecutor`.

`std.Target.canExecBinaries` of is removed; callers should use the more
powerful `getExternalExecutor` instead.

Now that `zig test` tries to run the resulting binary no matter what,
this commit has a follow-up change to the build system and docgen to
utilize the `getExternalExecutor` function and pass `--test-no-exec`
in some cases to avoid getting the error.

Additionally:

 * refactor: extract NativePaths and NativeTargetInfo into their own
   files named after the structs.
 * small improvement to langref to reduce the complexity of the `callconv`
   expression in a couple examples.

```

## Parents

- [0cd87102221233c2885faccfcaaac297b8d3b656](https://git.cafe/gitcafe/zig/commit/0cd87102221233c2885faccfcaaac297b8d3b656?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/f3edff439e2dd8e4055d21507b352141cd5b1718?format=markdown)
