-
Notifications
You must be signed in to change notification settings - Fork 215
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
feat: system/exec() function call ( #1043) #1067
Conversation
Awesome, thanks @forbesmyester !!! I'll take a look this weekend 😁 |
cmd.Stdin = strings.NewReader(pe.Value.AcquireStringValue()) | ||
} | ||
} | ||
|
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.
this could really use if ... else if ... else
and handle the unexpected "none of the above" in the else
that said, miller DSL source code doesn't propagate go-style error
returns as much as it should, so without reworking the BIF
API, the best you could do would be to print to stderr
and exit 1
(which isn't great but is what i've done all over the place in the DSL)
thanks @forbesmyester !!!!! :D |
very much not a concern for me ... my perspective after having spent a long time in software is that readability and clarity is all that matters, and this is very clear :) as an after-commit i'm running ... 5ffb8a5 |
... oops, I may have merged too quickly:
|
(also could use some unit tests) |
Hmmm, So I think my code is good, but my docs are bad (because it's not what I was actually using to test). Thinking about it, it not interpolinating the $YOUR_NAME is exactly what we want and illustrates the whole purpose of this code! I'm a bit unsure how to go about adding tests to this given that it's purpose is to shell out to the system and that's not going to be consistent across platforms... This (ugly thing) below how I was testing my code. As you can see it does send the environment across: the_path/toexec
the command
the output
How should we proceed? Should I just fix the docs? |
yes please! :) |
Feature as detailed in #1043
Changes from discussed
env
, I did not use a dictionary / map for environmental variables but instead an array with KEY=VALUE items, as this matches the golang APIstring_input
tostdin_string
as that seemed bettercombined_output
option which includes both STDOUT and STDERR as it seemed like a good idea and was easy with the golang API.NOTE: I've never wrote (, or practically even looked at) any golang code before. I'm not sure on how good this is, specifically my define a variable then use an
if
/else
afterwards (combinedOutput) to change it seems naff.Happy to have feedback.