Skip to content

Commit

Permalink
Allow not-quite-regular files
Browse files Browse the repository at this point in the history
With this you can do:

  echo 'sig Thing {} run { one Thing }' | alloy exec /dev/stdin

or

  alloy exec <( echo 'sig Thing {} run { one Thing }' )

which allows easier integration into external tools.

Signed-off-by: Brock Wilcox <[email protected]>
  • Loading branch information
awwaiid authored and pkriens committed Apr 23, 2024
1 parent 019f82c commit d4e5880
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,15 @@ public void _exec(ExecOptions options) throws Exception {

String filename = options._arguments().remove(0);
File file = IO.getFile(filename);
if (!file.isFile()) {
error("No such file %s", file);
return;
}
if (!file.canRead()) {
error("Cannot read file %s", file);
return;
}
if (file.isDirectory()) {
error("%s must be a file, not a directory", file);
return;
}


Map<String, String> cache = new HashMap<>();
CompModule world = CompUtil.parseEverything_fromFile(rep, cache, filename);
Expand Down

0 comments on commit d4e5880

Please sign in to comment.