Skip to content

os.execv is missing, and other os methods like os.execl appear to try to use it #1992

@illicitonion

Description

@illicitonion
$ cargo run -- -c 'import os ; os.execv("/bin/echo", ["/bin/echo", "Hello"])'
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/rustpython -c 'import os ; os.execv("/bin/echo", ["/bin/echo", "Hello"])'`
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'os' has no attribute 'execv'
$ cargo run -- -c 'import os ; os.execl("/bin/echo", *["/bin/echo", "Hello"])'
    Finished dev [unoptimized + debuginfo] target(s) in 0.14s
     Running `target/debug/rustpython -c 'import os ; os.execl("/bin/echo", *["/bin/echo", "Hello"])'`
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/RustPython/Lib/os.py", line 437, in execl
    execv(file, args)
NameError: name 'execv' is not defined

Python Documentation

https://docs.python.org/3/library/os.html#os.execv

$ python -c 'import os ; os.execv("/bin/echo", ["/bin/echo", "Hello"])'
Hello
$ python -c 'import os ; os.execl("/bin/echo", *["/bin/echo", "Hello"])'
Hello

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions