code: func (a *Agent) remoteExecWriteKey(event *remoteExecEvent, suffix string, val []byte) error {
  	key := path.Join(event.Prefix, event.Session, a.config.NodeName, suffix)
  	write := structs.KVSRequest{
  		Datacenter: a.config.Datacenter,
  		Op:         api.KVLock,
  		DirEnt: structs.DirEntry{
  			Key:     key,
  			Value:   val,
  			Session: event.Session,
  		},
  	}
  	write.Token = a.tokens.AgentToken()
  	var success bool
  	if err := a.RPC("KVS.Apply", &write, &success); err != nil {
  		return err
  	}
  	if !success {
  		return fmt.Errorf("write failed")
  	}
  	return nil
  }
docs: // remoteExecWriteKey is used to write an output key for a remote exec job