|  |  | @ -9,6 +9,7 @@ import ( | 
			
		
	
		
		
			
				
					
					|  |  |  | 	"path" |  |  |  | 	"path" | 
			
		
	
		
		
			
				
					
					|  |  |  | 	"path/filepath" |  |  |  | 	"path/filepath" | 
			
		
	
		
		
			
				
					
					|  |  |  | 	"strings" |  |  |  | 	"strings" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	"sync/atomic" | 
			
		
	
		
		
			
				
					
					|  |  |  | 	"time" |  |  |  | 	"time" | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	"github.com/docker/buildx/driver" |  |  |  | 	"github.com/docker/buildx/driver" | 
			
		
	
	
		
		
			
				
					|  |  | @ -369,7 +370,11 @@ func (d *Driver) Client(ctx context.Context) (*client.Client, error) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	var opts []client.ClientOpt |  |  |  | 	var opts []client.ClientOpt | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	var counter int64 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	opts = append(opts, client.WithContextDialer(func(context.Context, string) (net.Conn, error) { |  |  |  | 	opts = append(opts, client.WithContextDialer(func(context.Context, string) (net.Conn, error) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if atomic.AddInt64(&counter, 1) > 1 { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			return nil, net.ErrClosed | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return conn, nil |  |  |  | 		return conn, nil | 
			
		
	
		
		
			
				
					
					|  |  |  | 	})) |  |  |  | 	})) | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if td, ok := exp.(client.TracerDelegate); ok { |  |  |  | 	if td, ok := exp.(client.TracerDelegate); ok { | 
			
		
	
	
		
		
			
				
					|  |  | @ -395,7 +400,10 @@ func (d *Driver) Features() map[driver.Feature]bool { | 
			
		
	
		
		
			
				
					
					|  |  |  | func demuxConn(c net.Conn) net.Conn { |  |  |  | func demuxConn(c net.Conn) net.Conn { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	pr, pw := io.Pipe() |  |  |  | 	pr, pw := io.Pipe() | 
			
		
	
		
		
			
				
					
					|  |  |  | 	// TODO: rewrite parser with Reader() to avoid goroutine switch
 |  |  |  | 	// TODO: rewrite parser with Reader() to avoid goroutine switch
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	go stdcopy.StdCopy(pw, os.Stderr, c) |  |  |  | 	go func() { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		_, err := stdcopy.StdCopy(pw, os.Stderr, c) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		pw.CloseWithError(err) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	}() | 
			
		
	
		
		
			
				
					
					|  |  |  | 	return &demux{ |  |  |  | 	return &demux{ | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Conn:   c, |  |  |  | 		Conn:   c, | 
			
		
	
		
		
			
				
					
					|  |  |  | 		Reader: pr, |  |  |  | 		Reader: pr, | 
			
		
	
	
		
		
			
				
					|  |  | 
 |