Skip to content

Commit 9be8106

Browse files
committed
setenv return int
1 parent 2fb97d9 commit 9be8106

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

expose.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,13 @@ extern "C"
403403
return gpttype_clear_state_kv(true);
404404
}
405405

406-
void set_environment_variable(const char * identifier, const char * value)
406+
int set_environment_variable(const char * identifier, const char * value)
407407
{
408+
if (!identifier || !value) return -1;
408409
#ifdef _WIN32
409-
_putenv_s(identifier, value);
410+
return _putenv_s(identifier, value);
410411
#else
411-
setenv(identifier, value, 1);
412+
return setenv(identifier, value, 1);
412413
#endif
413414
}
414415
}

koboldcpp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,8 @@ def init_library():
949949
handle.last_logprobs.restype = last_logprobs_outputs
950950
handle.detokenize.argtypes = [token_count_outputs]
951951
handle.detokenize.restype = ctypes.c_char_p
952+
handle.set_environment_variable.restype = ctypes.c_int
953+
handle.set_environment_variable.argtypes = [ctypes.c_char_p, ctypes.c_char_p]
952954

953955
def set_backend_props(inputs):
954956
# we must force an explicit tensor split

0 commit comments

Comments
 (0)