awarbler / yashd_project

0 stars 0 forks source link

Client Side background foreground set up #29

Closed awarbler closed 1 month ago

awarbler commented 1 month ago

Proper Handling of Background Jobs: Client side

Action Plan to Fix:

  1. Fix Background (&) Job Handling:

Modify the execute_command function to properly handle background jobs (&). Ensure that if a command ends with &, it is treated as a background job, and the shell doesn’t wait for it to complete.

Here’s how you can modify the logic:

Fix fg and bg Commands:

The fg command should bring a stopped or background job to the foreground, and bg should resume a stopped job in the background.

Here’s how you can fix fg_job and bg_job:

Testing and Debugging:

Here’s how you can test your implementation:

Background Job: Run sleep 10 & to check if the job is properly sent to the background. Use jobs to check if it is listed. Foreground Job: Use fg %job_id to bring a background job to the foreground. Test Ctrl-C and Ctrl-Z while the job is in the foreground. Stopped Job: Run a command, press Ctrl-Z to stop it, then use fg and bg to test moving the job between foreground and background. Conclusion: Ensure that the execute_command, fg_job, and bg_job functions are handling job control properly. Test background and foreground jobs to confirm proper signal handling (Ctrl-C, Ctrl-Z) and job management.

awarbler commented 1 month ago

Foreground and background set up correctly on the client