Commit d277c56
authored
fix(builtins): implement
## Summary
- Implement proper `declare -f` flag handling in the declare builtin
- `declare -f name` now returns exit 1 when function doesn't exist (was
always returning 0)
- `declare -f name` prints function stub and returns 0 when function
exists
- `declare -f` with no args lists all defined functions
- This completes subprocess isolation for script-by-path execution
(#792): the isolation itself (clearing functions in child scope) already
worked, but `declare -f helper` always returned success regardless
## Test plan
- [x] `declare_f_nonexistent_function_returns_1` — verifies exit code 1
for missing functions
- [x] `declare_f_existing_function_prints_definition` — verifies exit
code 0 and output for existing functions
- [x] `declare_f_no_args_lists_all_functions` — verifies listing all
functions
- [x] `exec_script_functions_not_inherited` — verifies functions not
visible in subprocess scripts
- [x] Full test suite passes (`cargo test --all-features`)
- [x] `cargo fmt --check` and `cargo clippy` clean
Closes #792declare -f for function display and lookup (#822)1 parent 7962756 commit d277c56
File tree
2 files changed
+79
-0
lines changed- crates/bashkit
- src/interpreter
- tests
2 files changed
+79
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4912 | 4912 | | |
4913 | 4913 | | |
4914 | 4914 | | |
| 4915 | + | |
4915 | 4916 | | |
4916 | 4917 | | |
4917 | 4918 | | |
| |||
4926 | 4927 | | |
4927 | 4928 | | |
4928 | 4929 | | |
| 4930 | + | |
4929 | 4931 | | |
4930 | 4932 | | |
4931 | 4933 | | |
| |||
4943 | 4945 | | |
4944 | 4946 | | |
4945 | 4947 | | |
| 4948 | + | |
| 4949 | + | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
| 4953 | + | |
| 4954 | + | |
| 4955 | + | |
| 4956 | + | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
| 4960 | + | |
| 4961 | + | |
| 4962 | + | |
| 4963 | + | |
| 4964 | + | |
| 4965 | + | |
| 4966 | + | |
| 4967 | + | |
| 4968 | + | |
| 4969 | + | |
| 4970 | + | |
| 4971 | + | |
| 4972 | + | |
| 4973 | + | |
| 4974 | + | |
4946 | 4975 | | |
4947 | 4976 | | |
4948 | 4977 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
0 commit comments