-
Notifications
You must be signed in to change notification settings - Fork 508
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
Debugging a script that invokes exiftool.exe hangs #3225
Comments
This may well be a duplicate of #2559. We did some investigation around that issue but weren't able to determine why exiftool.exe specifically interacts badly with the Integrated Console. Unfortunately, we're not likely to be able to prioritise such a specific bug before other issues we're currently working toward. |
Even if not a exact duplicate this does look like it's a very close issue. I was so convinced this could not be specific to exiftool that I didn't bother searching for that in the existing issues 😜 I do understand that this is very specific and thus low priority. I'll start looking for workarounds... (all my photo/video related tooling relies on exiftool to extra e.g. the 'date taken' from DSLR RAW images...) |
Honestly I'm perplexed as to why this occurs with exiftool. I did look into it with the last issue but couldn't see a good reason (it's basically a self-contained Perl script right?). Anyway, if it's a bad PSReadLine interaction due to the idiosyncrasies of the Integrated Console, it might be something we can mitigate as we rework the integrated console. |
As I had to work on my picture/video management scripts during the holidays, I was hit by this issue once again. Would there be a way to detect that a script is running under the debugger, so that it could be prevented from running there? This way I would just be reminded that I must run the script outside of VScode? |
@sba923 yes, you can |
I confirm this works, so I'm spreading this all around 😥 if ($env:TERM_PROGRAM -eq 'vscode')
{
Write-Host -ForegroundColor Red ("This script uses 'exiftool'. It will hang if invoked from VScode.")
Exit(1)
} Anything I could do to help getting rid of this issue? |
Can you try just pressing any key when it appears stuck? Make sure the terminal is focused (click somewhere inside it) and just press enter. Please let me know if it continues after that. |
yes it does continue, even after pressing |
Yeah that checks out. I think I know what's up, we'll get it fixed if it is what I think. |
btw as a workaround this does the job: '' | exiftool -DateTimeOriginal foobar.cr2 Just piping literally anything is enough. |
Thanks for sharing this workaround. |
Just curious: could you elaborate on what/where the cause is/lies? |
My guess is that whatever way they check to see if they should expect input is getting triggered by the fact that we have Purely guess work until we change up how readkey works, but I'm fairly confident. |
Hi there, we just released v2022.4.0-preview! Could you please try PowerShell Preview for VS Code and verify this is fixed? |
Hi, What I get with $exiftool = (Get-Command exiftool).Path
Write-Host ("'exiftool' is '{0}' (version {1}) {{MD5={2}}}" -f $exiftool, (Get-Item $exiftool).VersionInfo.ProductVersion, (Get-Filehash -Algorithm MD5 $exiftool).Hash)
$exiftool_args = @('-DateTimeOriginal', (Join-Path -Path $PSScriptRoot -ChildPath 'foobar.cr2'))
Write-Host ("Invoking '{0} {1}'" -f $exiftool, ($exiftool_args -join ' '))
& $exiftool @exiftool_args is:
|
Yay! Then this is resolved. I'm aware of the dummy character, there's a race inside PSReadLine that we need to resolve with that project, and so right now we send a dummy character that's just:
Which should be a no-op (but clearly isn't, as you're getting an accented a, and another person is getting a quote). |
This issue has been marked as fixed. It has been automatically closed for housekeeping purposes. |
Can you please confirm this (the dummy character) is fixed with version 2022.5.0 of the extension and PSReadLine 2.2.5? |
Yes indeed it is! |
Good news! This means I'll no longer need to use the workaround $result = '' | & $exiftool @exiftool_args and will be able to use the standard construct instead: $result = & $exiftool @exiftool_args Thanks again for the fix. I've been patient 😜. |
Very patient. Thank you! |
System Details
System Details Output
Issue Description
When I run the following script under the PowerShell debugger within VScode, it hangs when launching
exiftool.exe
:Expected Behaviour
When running outside of the debugger (in a standalone PowerShell session, or in the VScode terminal), I get the expected results:
Actual Behaviour
When run via the debugger (F5 in VScode) the script hangs:
Here's the version of
exiftool.exe
on my system:exiftool.zip
Attached Logs
1614863299-c8495592-f210-48e1-a203-cc687e42687b1614861694455 - Copy.zip
The text was updated successfully, but these errors were encountered: