Skip to content

Always on top fails to pin powershell properly when another command line program is running, then finishes #31365

Open
@Flyingbacen

Description

Microsoft PowerToys version

0.78.0

Installation method

GitHub

Running as admin

No

Area(s) with issue?

Always on Top

Steps to reproduce

image
attempting to close powershell 7.4.1 with always on top enabled caused it to freeze, and had to be closed with task manager. The log file had [2024-02-08 23:25:40.006516] [p-12468] [t-12472] [error] Failed to unpin window, Invalid window handle. I believe this may be because it detects the other command line program and pins that instead, and when the command finishes, the console is the same, so it doesn't delatch from the original process before closing the app.

  1. start powershell 7.4.1 normally from the start menu
  2. run a custom script I created for downloading a stream, and enable always on top midway through operation. The command finished after cancelling with ctrl+c, and I closed powershell with the x in the corner. The console went away, and the window controls(?) stayed, as shown in the image.

✔️ Expected Behavior

The application to close properly without error

❌ Actual Behavior

The console disappeared, leaving the window controls

Other Software

Powershell 7.4.1
custom powershell script ran with parameters -time 00:00-15:00 -link https://www.twitch.tv/##### -number [any number] -topic cats:

function turtlesong {
    param(
        [Parameter(Mandatory)]
        [string]$time,
        [Parameter(Mandatory)]
        [string]$link,
        [Parameter(Mandatory)]
        [string]$number,
        [string]$topic
    )
    if ("$topic" -ne "") {
        $topic = ".($topic)"
    }

    if ((Test-Path "C:\Users\#####\turtlesongs\song.$number$topic.mp4") -eq $false) {
        C:\Users\#####\.stacher/youtube-dl --embed-metadata --no-check-certificate --ffmpeg-location C:\Windows\ --download-sections "*$time" -o "C:\Users\#####\turtlesongs\song.$number$topic.mp4" $link 
        
        $choice = Read-Host "Use ffmpeg and convert to audio? (y/n)"
        if ($choice -eq "y") {
            ffmpeg -i "C:\Users\#####\turtlesongs\song.$number$topic.mp4" -vn -c:a copy "C:\Users\#####\turtlesongs\audio\song.$number$topic.m4a"
        } else {
            write-host "Not converting to audio."
        }
    } else {
        Write-Warning -Message "Song with number ""$number"" already downloaded."
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-App CompatIssues revolving around application compatibility across PowerToysIssue-BugSomething isn't workingProduct-Always On TopRefers to the idea of a Always on Top Powertoy

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions