kopia lustrzana https://github.com/micropython/micropython-lib
os: Add system().
rodzic
d32312e2d8
commit
4e3154ba21
|
@ -1,5 +1,5 @@
|
|||
srctype = micropython-lib
|
||||
type = package
|
||||
version = 0.1.2
|
||||
version = 0.1.3
|
||||
author = Paul Sokolovsky
|
||||
depends = libc
|
||||
|
|
|
@ -28,6 +28,7 @@ pipe_ = libc.func("i", "pipe", "p")
|
|||
_exit_ = libc.func("v", "_exit", "i")
|
||||
getpid_ = libc.func("i", "getpid", "")
|
||||
waitpid_ = libc.func("i", "waitpid", "ipi")
|
||||
system_ = libc.func("i", "system", "s")
|
||||
|
||||
R_OK = const(4)
|
||||
W_OK = const(2)
|
||||
|
@ -167,6 +168,10 @@ def waitpid(pid, opts):
|
|||
check_error(r)
|
||||
return (r, a[0])
|
||||
|
||||
def system(command):
|
||||
r = system_(command)
|
||||
check_error(r)
|
||||
return r
|
||||
|
||||
def fsencode(s):
|
||||
if type(s) is bytes:
|
||||
|
|
|
@ -6,7 +6,7 @@ from setuptools import setup
|
|||
|
||||
|
||||
setup(name='micropython-os',
|
||||
version='0.1.2',
|
||||
version='0.1.3',
|
||||
description='os module for MicroPython',
|
||||
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.",
|
||||
url='https://github.com/micropython/micropython/issues/405',
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
import os
|
||||
|
||||
print("Executing ls -l:")
|
||||
os.system("ls -l")
|
Ładowanie…
Reference in New Issue