fork/gdu

git clone https://git.julia.blue/fork/gdu

cosmolifeat: move items to XDG trash with D key (#12) (#608)9ca5c60

master
755 B33 linesraw
1//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd || solaris
2
3package remove
4
5import (
6	"path/filepath"
7	"syscall"
8	"testing"
9	"time"
10
11	"github.com/stretchr/testify/assert"
12	"github.com/stretchr/testify/require"
13)
14
15func TestCopyRecursivelyRejectsFIFOWithoutBlocking(t *testing.T) {
16	root := t.TempDir()
17	src := filepath.Join(root, "fifo")
18	dst := filepath.Join(root, "copied-fifo")
19	require.NoError(t, syscall.Mkfifo(src, 0o600))
20
21	done := make(chan error, 1)
22	go func() {
23		done <- copyRecursively(src, dst)
24	}()
25
26	select {
27	case err := <-done:
28		require.Error(t, err)
29		assert.Contains(t, err.Error(), "unsupported file type")
30	case <-time.After(500 * time.Millisecond):
31		t.Fatal("copyRecursively blocked while opening a FIFO")
32	}
33}