-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Exec cmd failed silently #151
Comments
If I use the exec command, then it works properly
|
When you say "it doesn't work even though exit code return 0", what do you mean? What does the program print to stdout? If the |
@bitfield I tried adding However, if there is no |
I think you're running into #148 here—clearly the program is returning some error, but we're not seeing it. Let me check back with you here once that issue is fixed, and we'll see if that sheds any light on the problem. |
Could you check your program against |
@bitfield This is very interesting. It might have something to do with onepassword cli. I tried this script version and still the same problem
Output with
and If I run this with just my terminal this is what I got
|
you can easily reproduce this by install onepassword cli
On mac you do
|
ping! @bitfield, Is there any update on this bug? Here is the minimal code to reproduce it, and the output using the minimal code to reproduce
op cli output in terminal
script package output
Notes: |
I don't have anything useful for you at the moment; I can point out a couple of problems with your program, though.
func main() {
cmd := `op whoami`
p := script.Exec(cmd)
_, err := p.Stdout()
if err != nil {
log.Fatal(err)
}
fmt.Println(p.ExitStatus())
} For me, this prints:
... which is roughly what I'd expect. I can't try |
@bitfield my bad on this. you don't need to do the package main
import (
"github.com/bitfield/script"
"github.com/rs/zerolog/log"
)
func main() {
cmd := `op item create`
exitCode, err := script.Exec(cmd).Stdout()
if err != nil {
log.Fatal().Err(err).Msg("failed at executing")
}
log.Info().Int("num", int(exitCode)).Msg("output")
}
|
@bitfield script should have been erroring out like the op command did like this
|
Yes, it looks as though the Evidently |
@bitfield true, true . yeah you can close this if you want. Pretty sure this is a |
I'll leave it open for now just in case anyone else has problems with automating |
I'm trying to execute a onepassword cli command and it doesn't work even though exit code return 0
If I add p.Wait() in there I will get error which is
How can I debug or fix this?
If I copied the exact thing into my terminal, it would work correctly.
The text was updated successfully, but these errors were encountered: