Skip to content
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

Refactor "process" package #966

Merged
merged 1 commit into from
Oct 18, 2020
Merged

Refactor "process" package #966

merged 1 commit into from
Oct 18, 2020

Conversation

boogie-byte
Copy link
Contributor

  • All context-less wrapping functions (the ones without WithContext
    suffix) were moved into process.go since they all are the same.
  • Call context is now passed to all underlying functions in
    *WithContext() functions.
  • All common *BSD bits were moved to process_bsd.go.
  • Process.Tgid() method lacked a WithContext counterpart, so
    Process.TgidWithContext() was added for uniformity.
  • NewProcessWithContext() function was added since NewProcess() is
    used a lot throughout the module, and there is no way to pass a
    context to it.

This is a part of #761 effort.

* All context-less wrapping functions (the ones without WithContext
suffix) were moved into process.go since they all are the same.
* Call context is now passed to all underlying functions in
*WithContext() functions.
* All common *BSD bits were moved to process_bsd.go.
* Process.Tgid() method lacked a WithContext counterpart, so
Process.TgidWithContext() was added for uniformity.
* NewProcessWithContext() function was added since NewProcess() is
used a lot throughout the module, and there is no way to pass a
context to it.

This is a part of shirou#761 effort.
@shirou
Copy link
Owner

shirou commented Oct 18, 2020

I found this PR changes to return nil instead of empty value when returning error on various functions like

func (p *Process) GidsWithContext(ctx context.Context) ([]int32, error) {
	return []int32{}, common.ErrNotImplementedError
}

This may break application code. but checking error value at first is a golang-way,
so I think this is not become a problem on application.

I merge this. Awesome work, Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants