diff --git a/docs/modules/os.md b/docs/modules/os.md index 0e1601a6..01f94a5d 100644 --- a/docs/modules/os.md +++ b/docs/modules/os.md @@ -42,3 +42,19 @@ Check if the given path exists. ### `os.path.basename(path: str)` Returns the basename of the given path. + + +## Other functions + +You can add other functions to `os` module via normal binding if you need them. +For example, add `os.system`: + +```cpp +PyObject* mod = vm->_modules["os"]; + +vm->bind(mod, "system(cmd: str) -> int", [](VM* vm, ArgsView args){ + const char* cmd = py_cast(vm, args[0]); + int code = system(cmd); + return py_var(vm, code); +}); +```