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: Prompt Command Detection (Also Code Style from PR 16) #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ChristianSilvermoon
Copy link
Contributor

I believe I've reasonably solved the the TODO:

TODO: add a way to check if we're running from PROMPT_COMMAND to use the previous exit code instead of doing things this way

By checking if our argument matches what the README suggests for $PROMPT_COMMAND's value, Shell Mommy can be confident that she is in fact, in all likelyhood, running from $PROMPT_COMMAND.

There isn't much of a reason to pass such a strange (and quite unpleasant to properly escape) argument to her otherwise x3

Merging #16 also introduced a strangely formatted If statement that both significantly goes against the current style, but also is (in my opinion, but it is really subjective) harder to read.

So this also brings that If Statement more in-line with the rest of Shell Mommy's If Statements

If the arguments passed to Shell Mommy are identical to
the recommended usage of

  export PROMPT_COMMAND="mommy \\$\\(exit \$?\\); $PROMPT_COMMAND"

Then we know that Shell Mommy is 99% most likely being run via
PROMPT_COMMAND and we don't need eval in this instance.
Pull Request sudofox#16 introduced
  if [[ $rc -eq 130 ]]
  then

But this is less legible and goes against the prior established
style of If Statements in Shell Mommy.
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.

1 participant