charmbracelet / freeze

Generate images of code and terminal output 📸
MIT License
3.24k stars 55 forks source link

Some commands don't work in Windows #73

Open Marin-Kitagawa opened 6 months ago

Marin-Kitagawa commented 6 months ago

Describe the bug The commands such as ls, dir, and many other Powershell commands such as Get-Clipboard search for an exectuable in $env:PATH or %PATH%. The following is the error thrown

exec: "ls": executable file not found in %PATH%

(Replace ls with any other Powershell command that produces an output)

Since it explicitly mentions %PATH% (instead of $env:PATH), I even tried the same command in cmd (I was using PowerShell 7 previously). I still got the same error.

To Reproduce Steps to reproduce the behavior:

  1. Open Windows Terminal (with either Powershell or Command Prompt profile)
  2. Type freeze --execute "ls", freeze --execute "dir" or freeze --execute "<any powershell command>"
  3. You'll now see the error

Expected behavior All the Windows-native or Powershell commands must work

Screenshots image

Desktop (please complete the following information):

maaslalani commented 6 months ago

Hey @Marin-Kitagawa can you try the following:

freeze --execute "cmd /c ls"
freeze --execute "cmd /c dir"
Marin-Kitagawa commented 5 months ago

This works. But I understand that Linux has binaries for each command be it ls or anything. But in Windows, is it possible to emulate the same function similar to Linux but not checking for availability of a binary in the PATH? I mean, could you please make it to execute directly in the default shell (without using any alias)?