blueloveTH 2 سال پیش
والد
کامیت
5e55df9b97
1فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      docs/modules/os.md

+ 16 - 0
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<CString>(vm, args[0]);
+    int code = system(cmd);
+    return py_var(vm, code);
+});
+```