diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-06-01 19:51:17 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-06-03 12:23:29 +0300 |
commit | 70314b3303f712a0277b80b23bc3613744e6178e (patch) | |
tree | c20b0cddf91b2d2303feee440ec07c36fd5d0cd6 /libbutl/command.cxx | |
parent | c0a025542988b63275fe1f9281020f4d4bec58a6 (diff) |
Add builtin weight
Also invent the notion of external builtin (builtin_info::function is NULL).
Diffstat (limited to 'libbutl/command.cxx')
-rw-r--r-- | libbutl/command.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libbutl/command.cxx b/libbutl/command.cxx index bb5287c..fadd617 100644 --- a/libbutl/command.cxx +++ b/libbutl/command.cxx @@ -227,9 +227,9 @@ namespace butl msg.c_str ()); } - builtin_function* bf (builtins.find (prog)); + const builtin_info* bi (builtins.find (prog)); - if (bf != nullptr) // Execute the builtin. + if (bi != nullptr && bi->function != nullptr) // Execute the builtin. { if (callback) { @@ -259,17 +259,17 @@ namespace butl uint8_t r; // Storage. builtin_callbacks cb; - builtin b (bf (r, - args, - nullfd /* stdin */, - move (rd) /* stdout */, - nullfd /* stderr */, - cwd, - cb)); + builtin b (bi->function (r, + args, + nullfd /* stdin */, + move (rd) /* stdout */, + nullfd /* stderr */, + cwd, + cb)); return process_exit (b.wait ()); } - else // Execute the program. + else // Execute the program. { // Strip the potential leading `^`, indicating that this is an external // program rather than a builtin. Consider only simple paths and don't |