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

cpuhotplug06.sh: use '-h' to identify top or htop #1187

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

Conversation

liangxiao1
Copy link
Contributor

'v' is invalid option for both top and htop in newer version.
Replace it with 'h' to make it work in earlier and current version.

'v' is invalid option for both top and htop in newer version.
Replace it with 'h' to make it work in earlier and current version.

Signed-off-by: Xiao Liang <xiliang@redhat.com>
@metan-ucw
Copy link
Member

metan-ucw commented Sep 16, 2024

What happens in the case that -v is a valid top option? Is the test stuck in the "top -v |grep htop"?

In other words the commit description does not explain clearly enough why this is needed.

@liangxiao1
Copy link
Contributor Author

liangxiao1 commented Sep 19, 2024

What happens in the case that -v is a valid top option? Is the test stuck in the "top -v |grep htop"?

The test can complete. When '-v' is invalid, "top -v" redirects its output to stderr, so "top -v|grep htop" always return 1 and cannot identify top or htop as expected.

In other words the commit description does not explain clearly enough why this is needed.

Hope below example can explain why this is needed. Thanks

$ top -v |grep top
top: invalid option -- 'v'
$ echo $?
1
$ top -h|grep top
 top [options]
For more details see top(1).
$ echo $?
0

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