Skip to content

fix ports/unix builds besides coverage #7364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ports/unix/modos.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
#endif
#endif

#if defined(MICROPY_UNIX_COVERAGE)
mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_);
#endif

STATIC mp_obj_t mod_os_urandom(mp_obj_t num) {
mp_int_t n = mp_obj_get_int(num);
vstr_t vstr;
Expand Down Expand Up @@ -193,12 +197,13 @@ STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) {
}
MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system);

mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_);
STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) {
#if defined(MICROPY_UNIX_COVERAGE)
mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none);
if (result != mp_const_none) {
return result;
}
#endif
const char *s = getenv(mp_obj_str_get_str(var_in));
if (s == NULL) {
return mp_const_none;
Expand Down