Skip to content

fix: include stderr when errors are reported #41

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

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ type Run struct {
func (r *Run) Text() (string, error) {
r.lock.Lock()
defer r.lock.Unlock()
if r.err != nil {
return "", fmt.Errorf("run encounterd an error: %w with error output: %s", r.err, r.errput)
}

return r.output, nil
return r.output, r.Err()
}

// Bytes returns the output of the gptscript in bytes. It blocks until the output is ready.
Expand All @@ -62,7 +59,10 @@ func (r *Run) State() RunState {

// Err returns the error that caused the gptscript to fail, if any.
func (r *Run) Err() error {
return r.err
if r.err != nil {
return fmt.Errorf("run encounterd an error: %w with error output: %s", r.err, r.errput)
}
return nil
}

// Program returns the gptscript program for the run.
Expand Down