Question: Type this in python In this assignment you will implement the RUN functionality of your command interpreter . Your RUN command takes one argument. The
Type this in python
In this assignment you will implement the RUN functionality of your command interpreter.
Your RUN command takes one argument. The executable file specified by the argument should be run and when finished, the prompt displayed. The syntax is:
RUN executable-file
The algorithm for RUN would be as follows.
Define a parent function in which you:
Fork a child process.
Block the parent process to wait till child process ends
If child process is created successfully, call a child function that implements the child process
Define a child function from which you execute the executable program
This will require the following library functions (in Python on UNIX)
os.fork( ) creates a child process and returns the PID of the child process to the parent. Child PID is 0.
subprocess.call(path/executableProgram) executes a program in the current process
os.waitpid(pid,0) causes the parent to block until the child finishes
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
