os.execvp on windows doesn't wait for the executed program to finish and doesn't report it's exit code
Đang mở
Chưa có ai nhận issue này.
OS-windows
type-bug
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug report
os.execvp on windows doesn't wait for the executed program to finish and doesn't report it's exit code. Code:
import os
import sys
if len(sys.argv) > 1 and sys.argv[1] == "my_argument":
sys.stderr.write("my_argument detected. Exiting with code 1.\n")
sys.exit(1)
else:
sys.stderr.write("no argument detected. Calling os.execvp\n")
os.execvp(sys.executable, [sys.executable] + sys.argv + ["my_argument"])
bat file:
@echo off
python exec.py
if %errorlevel% NEQ 0 (
echo The script gave exit code %errorlevel%
) else (
echo Error: The script exited with exit code 0
)
Output from command prompt:
C:\pythonizer\play>exec.bat
no argument detected. Calling os.execvp
Error: The script exited with exit code 0
C:\pythonizer\play>my_argument detected. Exiting with code 1.
Note the command prompt prompted me for a new command before the exec'd process wrote out it's message.
Your environment
- CPython versions tested on: 3.10.6
- Operating system and architecture: Windows 10
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện hành vi của Windows 10 với script Python và tệp batch được cung cấp, sau đó lần theo điểm vào os.execvp và phần triển khai của nó trên Windows. Hoàn thành có nghĩa là chương trình được thực thi kết thúc trước khi tệp batch tiếp tục và mã thoát khác 0 của chương trình được báo cáo cho bên gọi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- operating-systems
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100