github.com/qichengzx/mattermost-server@v4.5.1-0.20180604164826-2c75247c97d0+incompatible/plugin/rpcplugin/process.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package rpcplugin
     5  
     6  import (
     7  	"context"
     8  	"io"
     9  )
    10  
    11  type Process interface {
    12  	// Waits for the process to exit and returns an error if a problem occurred or the process exited
    13  	// with a non-zero status.
    14  	Wait() error
    15  }
    16  
    17  // NewProcess launches an RPC executable in a new process and returns an IPC that can be used to
    18  // communicate with it.
    19  func NewProcess(ctx context.Context, path string) (Process, io.ReadWriteCloser, error) {
    20  	return newProcess(ctx, path)
    21  }
    22  
    23  // When called on a process launched with NewProcess, returns the inherited IPC.
    24  func InheritedProcessIPC() (io.ReadWriteCloser, error) {
    25  	return inheritedProcessIPC()
    26  }