Skip to content

Commit

Permalink
(GH-649) Error if executable is text file
Browse files Browse the repository at this point in the history
When attempting to act on a downloaded file, it may be a text file and
not a binary. When that is determined, throw an error instead.
  • Loading branch information
ferventcoder committed Apr 24, 2016
1 parent 07277ac commit d7b4de5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ Elevating Permissions and running [`"$exeToRun`" $wrappedStatements]. This may t

Write-Debug $dbgMessage

$exeIsTextFile = [System.IO.Path]::GetFullPath($exeToRun) + ".istext"
if (([System.IO.File]::Exists($exeIsTextFile))) {
throw "The file was a text file but is attempting to be run as an executable - '$exeToRun'"
}

# Redirecting output slows things down a bit.
$writeOutput = {
if ($EventArgs.Data -ne $null) {
Expand Down

0 comments on commit d7b4de5

Please sign in to comment.