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

Imitate terminal clear command in manager #2307

Merged
merged 1 commit into from
Dec 25, 2024
Merged

Conversation

bryanyee33
Copy link
Contributor

@bryanyee33 bryanyee33 commented Dec 22, 2024

The current implementation of KSU manager's output screen simply prints [H[J when the clear command is used (in both the flashing module & action button screen) instead of clearing the screen:

This limits the ability of shell scripts to purely textual & linear outputs, and prevents more flexible outputs such as a refreshing progress bar or even a progress circle for long running scripts. The current implementation moreover limits the output to 65536 bytes for the String text, causing the app to hang once this limit has been reached for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the clear command in shell scripts to clear the screen. It works by checking if the current output line starts with "�[H�[J", which is the default output of the clear command in KSU's busybox, and clears the previous outputs if there is a match. This should work universally since the clear command defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the clear command is heavily used (24 times a second) to test for performance & reliability of the code:

screen-20241222-161937.mp4

Tested-by: backslashxx

@backslashxx
Copy link
Contributor

backslashxx commented Dec 22, 2024

bad_appel_modul_24_highcrf.mp4

here on my side, works well !

Tested-by: backslashxx <[email protected]>

backslashxx added a commit to backslashxx/bad-apple-ascii that referenced this pull request Dec 22, 2024
backslashxx added a commit to backslashxx/bad-apple-ascii that referenced this pull request Dec 22, 2024
backslashxx added a commit to backslashxx/bad-apple-ascii that referenced this pull request Dec 22, 2024
@backslashxx
Copy link
Contributor

so, 11998 tentatively?

[ "$KSU_VER_CODE" -ge 11998 ] && clear

@tiann tiann merged commit 18ba8cc into tiann:main Dec 25, 2024
14 checks passed
@backslashxx
Copy link
Contributor

here was the demo just for logging purposes
https://github.com/backslashxx/bad-apple-ascii/tree/magisk-module

rsuntk pushed a commit to rsuntk/KernelSU that referenced this pull request Dec 25, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
backslashxx pushed a commit to backslashxx/KernelSU that referenced this pull request Dec 25, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
backslashxx added a commit to backslashxx/bad-apple-ascii that referenced this pull request Dec 26, 2024
backslashxx pushed a commit to backslashxx/KernelSU that referenced this pull request Dec 26, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Dec 26, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Dec 26, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Dec 26, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
selfmusing pushed a commit to selfmusing/USlenreK that referenced this pull request Dec 26, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
armv7a pushed a commit to armv7a/KernelSU that referenced this pull request Dec 27, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
armv7a pushed a commit to armv7a/KernelSU that referenced this pull request Dec 27, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
armv7a pushed a commit to armv7a/KernelSU that referenced this pull request Dec 27, 2024
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
mrsrimar22 added a commit to KrustyCook/KernelSU that referenced this pull request Dec 27, 2024
* 'main' of https://github.com/KrustyCook/KernelSU:
  templates/shizuku.root: Fix shizuku service unable to run properly (tiann#2319)
  manager: module: refresh after webui usage (tiann#2317)
  manager: Add sort options on module's appbar (tiann#2308)
  ci: fix ksud release (tiann#2314)
  website: Update Japanese translation of installation guide (tiann#2296)
  Imitate terminal clear command in manager (tiann#2307)
  Minor UI improvements (tiann#2305)

Change-Id: 9a4b59b7bae0d2f47ef66c3e64498ded7f46c90b
Signed-off-by: mrsrimar22 <[email protected]>
@bryanyee33 bryanyee33 deleted the clear-command branch December 27, 2024 11:19
LeCmnGend pushed a commit to LeCmnGend/KernelSU that referenced this pull request Jan 4, 2025
The current implementation of KSU manager's output screen simply prints
`[H[J` when the `clear` command is used (in both the flashing module &
action button screen) instead of clearing the screen:
<img
src="https://github.com/user-attachments/assets/c30ceb87-13ac-4ba6-a7c5-045564e83181"
width="300" />

This limits the ability of shell scripts to purely textual & linear
outputs, and prevents more flexible outputs such as a refreshing
progress bar or even a progress circle for long running scripts. The
current implementation moreover limits the output to 65536 bytes for the
String `text`, causing the app to hang once this limit has been reached
for scripts with more verbose outputs.

This PR fixes these issues by allowing for usage of the `clear` command
in shell scripts to clear the screen. It works by checking if the
current output line starts with "�[H�[J", which is the default output of
the `clear` command in KSU's busybox, and clears the previous outputs if
there is a match. This should work universally since the `clear` command
defaults to this implementation when ran in KSU manager.

A working example can be seen below, where the `clear` command is
heavily used (24 times a second) to test for performance & reliability
of the code:


https://github.com/user-attachments/assets/c45fb6f1-1b40-4b67-8837-4d9a00429715

Tested-by: backslashxx
backslashxx added a commit to backslashxx/bad-apple-ascii that referenced this pull request Jan 6, 2025
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.

3 participants