Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix The issue when user exits it only shows cancelled by user Process exited #22

Conversation

mohidmeer
Copy link

When User exits via keyboard Interupt

Whenever user exits the process via keyboard interupt like CTRL+C (NoneType is passed which) it shows error in terminal as Follow

Before

image

After Fix

image

@mohidmeer
Copy link
Author

mohidmeer commented Aug 3, 2023

@ShishirPatil I saw this after the PR in issues someone already mentioned it #12 here

@ShishirPatil
Copy link
Member

Thanks for this PR @mohidmeer I think this might need a refactor for Linux and Mac systems? I still seem to get the traceback..

image

@mohidmeer
Copy link
Author

@ShishirPatil I used exit(); if NoneType is passed i should exit

@mohidmeer
Copy link
Author

@ShishirPatil if selected_command==None:
print('Process Exited')
exit();

@mohidmeer
Copy link
Author

Updated and verified on linux and windows

@ShishirPatil
image
image

@ShishirPatil
Copy link
Member

@ShishirPatil if selected_command==None: print('Process Exited') exit();

Thanks for this @mohidmeer
But you see the subsequent code requires that selected_command and exit_condition are populated to complete the request. You are write that the exit() will side-step it, but a) there is no log for what heppens then, so we can't tell if the command was successfully executed or if there is a syntax bug to fix, and b) using exit() in the middle of the file is considered bad practice unless otherwise strictly necessary! Hence, I suggested the below. Thoughts?

        if selected_command is not None:
            exit_condition = execute_command(selected_command)
        else:
            selected_command = "Cancelled"
            exit_condition = "Cancelled"

@mohidmeer
Copy link
Author

I understand now @ShishirPatil thanks for explanation you want to complete the life cycle of script Instead of abruptly exiting the code

@mohidmeer mohidmeer closed this Aug 5, 2023
@mohidmeer mohidmeer deleted the fix/cli-shows-error-if-user-exits-via-Interupt branch August 5, 2023 11:28
@mohidmeer mohidmeer restored the fix/cli-shows-error-if-user-exits-via-Interupt branch August 5, 2023 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants