OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
os.WEXITSTATUS() method in Python is used to get the integer parameter used by a process in exit(2) system call if
os.WIFEXITED(status) is True. If
os.WIFEXITED(status) is False then the method returns a meaningless value.
status: This parameter takes process status code (an integer value) as returned by os.system(), os.wait() or os.waitpid() method.
Return type: This method returns an integer value used by a process in exit(2) system call.
Code: Use of
In first child process Process ID: 11614 Hello! Geeks First child exiting.. In second child process Process ID: 11615 Hey! there Second child aborted In parent process First child's exit code: 5 Second child does not exited using exit(2) system call.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.