Skip to content

Commit 4e3154b

Browse files
committed
os: Add system().
1 parent d32312e commit 4e3154b

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

os/metadata.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
srctype = micropython-lib
22
type = package
3-
version = 0.1.2
3+
version = 0.1.3
44
author = Paul Sokolovsky
55
depends = libc

os/os/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
_exit_ = libc.func("v", "_exit", "i")
2929
getpid_ = libc.func("i", "getpid", "")
3030
waitpid_ = libc.func("i", "waitpid", "ipi")
31+
system_ = libc.func("i", "system", "s")
3132

3233
R_OK = const(4)
3334
W_OK = const(2)
@@ -167,6 +168,10 @@ def waitpid(pid, opts):
167168
check_error(r)
168169
return (r, a[0])
169170

171+
def system(command):
172+
r = system_(command)
173+
check_error(r)
174+
return r
170175

171176
def fsencode(s):
172177
if type(s) is bytes:

os/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
setup(name='micropython-os',
9-
version='0.1.2',
9+
version='0.1.3',
1010
description='os module for MicroPython',
1111
long_description="This is a module reimplemented specifically for MicroPython standard library,\nwith efficient and lean design in mind. Note that this module is likely work\nin progress and likely supports just a subset of CPython's corresponding\nmodule. Please help with the development if you are interested in this\nmodule.",
1212
url='https://github.com/micropython/micropython/issues/405',

os/test_system.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import os
2+
3+
print("Executing ls -l:")
4+
os.system("ls -l")

0 commit comments

Comments
 (0)