-
Notifications
You must be signed in to change notification settings - Fork 9
add debug flag to 'plural cd services lua' command #670
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
base: main
Are you sure you want to change the base?
Conversation
michaeljguarino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't print a lua built-in? I think all we need is to ensure it actually gets sent to os stdout. This is fine if it works, just seems like it might not be necessary
|
@michaeljguarino but we want to display stdout conditionally, depending on the debug flag, right? |
|
Stdout is now captured and shown only when debugging is enabled |
michaeljguarino
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually don't fully grok what this is doing. Is the idea that you're directing stdout to the pipe (which is going to receive the lua print built-ins) and then only actually printing it if debug is enabled?
|
Generally, yes, so the question is, how should it work? |
|
Should I add extra Go print, for example: |
|
The way it should work is any invocation of |
|
Exactly, the Lua engine sends the output of the built-in print function to stdout, so the issue was a bit misleading for me because I didn’t understand why the --debug flag was needed. I’ll take a closer look and try to reproduce the problem. If you have a faulty script that demonstrates this issue, it would be very helpful |
Summary
This PR updates the Lua state initialization to register a custom print() function that writes all Lua output to a Go bytes.Buffer. This allows capturing printed output from Lua scripts for debugging
Labels
Test Plan
Checklist