Skip to content

Commit 2dba2a0

Browse files
committed
Return error for not found with wsh file info
1 parent 5339c9c commit 2dba2a0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/wsh/cmd/wshcmd-file.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,14 @@ func fileInfoRun(cmd *cobra.Command, args []string) error {
231231

232232
info, err := wshclient.FileInfoCommand(RpcClient, fileData, &wshrpc.RpcOpts{Timeout: DefaultFileTimeout})
233233
err = convertNotFoundErr(err)
234-
if err == fs.ErrNotExist {
235-
return fmt.Errorf("%s: no such file", path)
236-
}
237234
if err != nil {
238235
return fmt.Errorf("getting file info: %w", err)
239236
}
240237

238+
if info.NotFound {
239+
return fmt.Errorf("%s: no such file", path)
240+
}
241+
241242
WriteStdout("name:\t%s\n", info.Name)
242243
if info.Mode != 0 {
243244
WriteStdout("mode:\t%s\n", info.Mode.String())

0 commit comments

Comments
 (0)