Skip to content

Capturing Scoop Output #1

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

Open
akippnn opened this issue Apr 10, 2023 · 0 comments
Open

Capturing Scoop Output #1

akippnn opened this issue Apr 10, 2023 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@akippnn
Copy link
Owner

akippnn commented Apr 10, 2023

I've tried several attempts to capture scoop output with no success. I've tried several approaches outlined below.

Currently, the only solution that works for capturing the raw output is by running Scoop commands with cmd /c <command> 2>&1, which is not a pretty solution and doesn't output colors or print to the console until the command finishes.

Redirecting the script's stdout & stderr to both the terminal and a variable (or a temp file, whichever is preferable) that can be parsed for more information, would be really helpful. For this case in this project, the only script I've added for now is an auto-updater, which would spawn a new Powershell window running the scoop update * command. The problem is that the update process needs to be transparent to the user: when it has started, the update process itself, and what errors occurred for some packages to fail to update.

Steps taken:

  • Tried using Invoke-Expression to capture Scoop output
  • Tried piping to Tee-Object and Out-String to capture Scoop output
  • Tried using the $strHwid variable to capture Scoop output, but it only works for Windows executables
  • Checked the Scoop documentation for information on capturing output, but did not find anything

Current workaround:

  • Running Scoop commands with cmd /c 2>&1 to capture the raw output
    The current autoupdate scripts does add a bit of transparency with the recent changes by properly reflecting the end result of the upate process, as well as numbers to help identify the error that has occurred.
    image
    As you can see, it is not perfect. The output in stdout is completely stripped of colors, and it does not stream the output as it would normally.
@akippnn akippnn added the help wanted Extra attention is needed label Apr 10, 2023
@akippnn akippnn pinned this issue Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant