-
Notifications
You must be signed in to change notification settings - Fork 61
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
freeze --execute
doesn't work with pipes/redirects
#67
Comments
freeze --execute
doesn't work with pipes/redirects
Just wanted to add some findings! I added in some print statements near Lines 30 to 38 in 80803eb
Assuming there is a file:
When you run
It only recognizes upto
If you try to add escape characters to the pipe such that it's
It recognizes the entire command
It throws an error, since I think that The fix mentioned was to use
It recognizes the command |
Behavior surrounding
yields the strange result of The expected result is git ls-remote --get-url origin
[email protected]:project/project.git |
Seems like if i did
gets you that picture for now!
For an input that is
but the |
Feature / Bug
I really like the
--execute
functionality of freeze but I am somewhat annoyed with the fact that I cannot execute commands with pipes or redirects. To provide a simple example, I created a file namedfile.txt
with the contents:cat file.txt | grep 'foo'
will return:freeze --execute "cat file.txt | grep 'foo'"
will return:It appears to stops parsing at the pipe and only executes
cat file.txt
. I checkedshellwords.Parse()
, which is called by pty.go,executeCommand()
, and the behavior might stem from there.I have no experience in Go so I can't be sure, but someone more knowledgeable than me might be able to verify. When I added test cases to check this in the parsing library, it appears to parse up until a pipe or redirect as expected. Apologies if my analysis is wrong, but in my cursory look at the code, that's what stood out to me.
Describe the solution you'd like
It would be nice if
--execute
would take any command and execute it to completion before creating the output image. Ideally, in the example above, that command should function identically and return the following image:Describe alternatives you've considered
To get the above image, I used
cat file.txt | grep 'foo' | freeze --language bash
. This isn't too complex of an alternative, but has two immediate downsides:--execute
in the first place.This also highlights that syntax highlighting will not work on
--execute
d inputs. If I wanted to do something likefreeze --execute "cat main.cpp"
, it would fail to properly highlight the syntax. I don't really think this is that problematic, but it is worthy of note. The--language
flag will not fix this and will output the same image.Additional context
I am using a non-standard freeze config but I can't imagine that's affecting anything in this case. I just like less padding & rounded corners on my images :)
The text was updated successfully, but these errors were encountered: