mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-09-01 22:53:05 +00:00
Previously, 'set KEY VALUE' in init.rc was not recognized as a builtin command. It fell through to posix_spawnp(), which ran it in a temporary child shell. The environment variable was set only in the child process and lost when it exited, so services started afterward never inherited it. Register cmd_set as an init builtin that calls setenv(key, value, 1) directly in the init process. The command takes exactly 2 arguments (key and value). All code is guarded by CONFIG_DISABLE_ENVIRON so it compiles out when environment support is disabled. Since child processes inherit init's environment, 'set TZ Asia/Shanghai' in init.rc now correctly propagates to all subsequently started services. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com> |
||
|---|---|---|
| .. | ||
| action.c | ||
| action.h | ||
| builtin.c | ||
| builtin.h | ||
| CMakeLists.txt | ||
| import.c | ||
| import.h | ||
| init.c | ||
| init.h | ||
| Kconfig | ||
| Make.defs | ||
| Makefile | ||
| parser.c | ||
| parser.h | ||
| property.h | ||
| property_simple.c | ||
| service.c | ||
| service.h | ||