-
|
I checked the codebase and there is no native subprocess module. Os defines def system(cmd: str) -> int but not popen. I don't want to add the weight of importing pOpen from python's subprocess so decided to try using the C popen. A simplified version of my code looks like: which returns
where this seems to be a pointer to type byte ( |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @john9631 -- from C import popen(cobj, cobj) -> cobj
from C import fgets(cobj, i32, cobj) -> cobj
pp = popen("ls -l".c_str(), "r".c_str())
n = 1000
p = cobj(n)
fgets(p, i32(n), pp)
print('read:', str.from_ptr(p)) |
Beta Was this translation helpful? Give feedback.
Hi @john9631 --
popenshould actually take twocobjs (which correspond to thechar *arguments in C). Here is the modified code which also callsfgets: