Skip to content

Fix Permission denied when auto-opening HTML report on macOS/Linux#11

Merged
jasonmoodie merged 1 commit into
microsoft:mainfrom
ngtanthanh-qc:fix/macos-auto-open-html
May 27, 2026
Merged

Fix Permission denied when auto-opening HTML report on macOS/Linux#11
jasonmoodie merged 1 commit into
microsoft:mainfrom
ngtanthanh-qc:fix/macos-auto-open-html

Conversation

@ngtanthanh-qc

Copy link
Copy Markdown
Contributor

Start-Process with a file argument on non-Windows PowerShell tries to execute the file as a binary instead of using the OS file association, so an .html report (no +x bit) fails with "Permission denied" and the script exits with a fatal error after the assessment otherwise succeeds.

Use the platform-native opener at the end of the script:

  • macOS: & open $htmlReportPath
  • Linux: & xdg-open $htmlReportPath
  • Windows: Start-Process $htmlReportPath (unchanged)

$IsMacOS / $IsLinux are PowerShell 6+ automatic variables, so this is a no-op on Windows PowerShell 5.1 where neither evaluates true.

Start-Process with a file argument on non-Windows PowerShell tries to
execute the file as a binary instead of using the OS file association,
so an .html report (no +x bit) fails with "Permission denied" and the
script exits with a fatal error after the assessment otherwise succeeds.

Use the platform-native opener at the end of the script:
- macOS:   & open  $htmlReportPath
- Linux:   & xdg-open $htmlReportPath
- Windows: Start-Process $htmlReportPath  (unchanged)

$IsMacOS / $IsLinux are PowerShell 6+ automatic variables, so this is a
no-op on Windows PowerShell 5.1 where neither evaluates true.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ngtanthanh-qc

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@jasonmoodie jasonmoodie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated changes and approving.

@jasonmoodie jasonmoodie merged commit 0abe4fc into microsoft:main May 27, 2026
6 checks passed
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.

2 participants