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

print a new line on exit #16439

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

teknoraver
Copy link

@teknoraver teknoraver commented Nov 11, 2021

When quitting the shell with ^D, a new line is not print in Unix:

mcroce@t490s:~$ pwsh
PowerShell 7.2.0
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/mcroce> mcroce@t490s:~$

Do it to keep the behaviour consistent with other Unix shell.
Fixes #16466

PR Summary

PR Context

PR Checklist

@daxian-dbw
Copy link
Member

daxian-dbw commented Nov 11, 2021

@teknoraver An issue should be created before submitting a PR for evaluating whether a fix is really needed. Can you please first open an issue for discussion? Here is the process defined in our document:
https://github.com/PowerShell/PowerShell/blob/master/docs/community/working-group.md#process

GitHub
PowerShell for every system! Contribute to PowerShell/PowerShell development by creating an account on GitHub.

@iSazonov iSazonov marked this pull request as draft November 12, 2021 03:10
@teknoraver teknoraver changed the title print a new line on exit print a new line on exit #16466 Nov 14, 2021
@teknoraver teknoraver changed the title print a new line on exit #16466 print a new line on exit Nov 14, 2021
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Nov 18, 2021
@ghost ghost added the Stale label Dec 3, 2021
@ghost
Copy link

ghost commented Dec 3, 2021

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

@teknoraver teknoraver marked this pull request as ready for review December 3, 2021 09:17
@ghost ghost removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept Stale labels Dec 3, 2021
@ghost ghost added the Review - Needed The PR is being reviewed label Dec 10, 2021
@ghost
Copy link

ghost commented Dec 10, 2021

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@iSazonov iSazonov marked this pull request as draft December 10, 2021 17:15
@ghost ghost added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Dec 13, 2021
@teknoraver
Copy link
Author

Hi @iSazonov, why this is marked as draft?

@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Dec 16, 2021
@iSazonov
Copy link
Collaborator

Hi @iSazonov, why this is marked as draft?

We need a conclusion in related issue before review the PR.

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Review - Needed The PR is being reviewed labels Dec 16, 2021
@ghost ghost added the Stale label Jan 3, 2022
@ghost
Copy link

ghost commented Jan 3, 2022

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

@teknoraver teknoraver marked this pull request as ready for review January 4, 2022 01:51
@ghost ghost removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept Stale labels Jan 4, 2022
@teknoraver
Copy link
Author

@daxian-dbw @anmenaga hi,

can I get a review for this trivial PR?

Copy link
Contributor

@JamesWTruher JamesWTruher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that this could be a break and change because you are now adding an extra line.

@@ -2675,6 +2675,9 @@ internal void Run(bool inputLoopIsNested)
_parent._isRunningPromptLoop = false;
}
}
#if UNIX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is right, it appears from this PR an extra new line would be produced when exit is used.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to overcome this, we should rework the code so to don't even print the prompt when EOF happens

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that there is already code that does something similar for Ctrl+C at https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs#L2555-L2561. I wonder if this case should be handled there as well.

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Jan 5, 2022
@ghost ghost added the Review - Needed The PR is being reviewed label Jan 16, 2022
@ghost
Copy link

ghost commented Jan 16, 2022

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@SteveL-MSFT
Copy link
Member

Having played with different Ctrl+D cases with bash, zsh, and pwsh, I think my bigger concern isn't that the prompt isn't on a newline, but if you start pwsh within pwsh and hit Ctrl+D, you don't have an indicator that you left the child pwsh. Someone may have nested pwsh and accidentally hit Ctrl+D and not know that they have exited and now running commands in the parent pwsh.

@ghost ghost removed the Review - Needed The PR is being reviewed label Jul 25, 2022
@SteveL-MSFT SteveL-MSFT added the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 1, 2022
@ghost ghost added the Stale label Aug 16, 2022
@ghost
Copy link

ghost commented Aug 16, 2022

This pull request has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 15 days. It will be closed if no further activity occurs within 10 days of this comment.

When quitting the shell with ^D, a new line is not print in Unix:

    mcroce@t490s:~$ pwsh
    PowerShell 7.2.0
    Copyright (c) Microsoft Corporation.

    https://aka.ms/powershell
    Type 'help' to get help.

    PS /home/mcroce> mcroce@t490s:~$

Do it to keep the behaviour consistent with other Unix shell and the
Windows version, which doesn't have this issue:

    Microsoft Windows [Version 10.0.19043.1348]
    (c) Microsoft Corporation. All rights reserved.

    C:\Users\mcroce>pwsh < NUL
    PowerShell 7.2.0
    Copyright (c) Microsoft Corporation.

    https://aka.ms/powershell
    Type 'help' to get help.

    PS C:\Users\mcroce>
    C:\Users\mcroce>
@ghost ghost removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 17, 2022
@pull-request-quantifier-deprecated

This PR has 11 quantified lines of changes. In general, a change size of upto 200 lines is ideal for the best PR experience!


Quantification details

Label      : Extra Small
Size       : +7 -4
Percentile : 4.4%

Total files changed: 2

Change summary by file extension:
.cs : +3 -0
.ps1 : +4 -4

Change counts above are quantified counts, based on the PullRequestQuantifier customizations.

Why proper sizing of changes matters

Optimal pull request sizes drive a better predictable PR flow as they strike a
balance between between PR complexity and PR review overhead. PRs within the
optimal size (typical small, or medium sized PRs) mean:

  • Fast and predictable releases to production:
    • Optimal size changes are more likely to be reviewed faster with fewer
      iterations.
    • Similarity in low PR complexity drives similar review times.
  • Review quality is likely higher as complexity is lower:
    • Bugs are more likely to be detected.
    • Code inconsistencies are more likely to be detected.
  • Knowledge sharing is improved within the participants:
    • Small portions can be assimilated better.
  • Better engineering practices are exercised:
    • Solving big problems by dividing them in well contained, smaller problems.
    • Exercising separation of concerns within the code changes.

What can I do to optimize my changes

  • Use the PullRequestQuantifier to quantify your PR accurately
    • Create a context profile for your repo using the context generator
    • Exclude files that are not necessary to be reviewed or do not increase the review complexity. Example: Autogenerated code, docs, project IDE setting files, binaries, etc. Check out the Excluded section from your prquantifier.yaml context profile.
    • Understand your typical change complexity, drive towards the desired complexity by adjusting the label mapping in your prquantifier.yaml context profile.
    • Only use the labels that matter to you, see context specification to customize your prquantifier.yaml context profile.
  • Change your engineering behaviors
    • For PRs that fall outside of the desired spectrum, review the details and check if:
      • Your PR could be split in smaller, self-contained PRs instead
      • Your PR only solves one particular issue. (For example, don't refactor and code new features in the same PR).

How to interpret the change counts in git diff output

  • One line was added: +1 -0
  • One line was deleted: +0 -1
  • One line was modified: +1 -1 (git diff doesn't know about modified, it will
    interpret that line like one addition plus one deletion)
  • Change percentiles: Change characteristics (addition, deletion, modification)
    of this PR in relation to all other PRs within the repository.


Was this comment helpful? 👍  :ok_hand:  :thumbsdown: (Email)
Customize PullRequestQuantifier for this repository.

@ghost ghost removed the Stale label Aug 17, 2022
@ghost ghost added the Review - Needed The PR is being reviewed label Aug 25, 2022
@ghost
Copy link

ghost commented Aug 25, 2022

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Extra Small Review - Needed The PR is being reviewed WG-Interactive-Console the console experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PowerShell doesn't print a new line on exit
6 participants