mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-12 03:04:40 +00:00
net/dns: fix checking for wrapped error when attempting to read wsl.conf for Windows WSL2
Fixes https://github.com/tailscale/tailscale/issues/3437
Signed-off-by: Aaron Klotz <aaron@tailscale.com>
(cherry picked from commit f93cf6fa03
)
This commit is contained in:
parent
3d9937513b
commit
32210788a2
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -193,7 +194,8 @@ func (fs wslFS) Truncate(name string) error { return fs.WriteFile(name, nil, 064
|
|||||||
|
|
||||||
func (fs wslFS) ReadFile(name string) ([]byte, error) {
|
func (fs wslFS) ReadFile(name string) ([]byte, error) {
|
||||||
b, err := wslCombinedOutput(fs.cmd("cat", "--", name))
|
b, err := wslCombinedOutput(fs.cmd("cat", "--", name))
|
||||||
if ee, _ := err.(*exec.ExitError); ee != nil && ee.ExitCode() == 1 {
|
var ee *exec.ExitError
|
||||||
|
if errors.As(err, &ee) && ee.ExitCode() == 1 {
|
||||||
return nil, os.ErrNotExist
|
return nil, os.ErrNotExist
|
||||||
}
|
}
|
||||||
return b, err
|
return b, err
|
||||||
|
Loading…
Reference in New Issue
Block a user