Fix #1745. Delete socket only if it exists (#2034)

* Fix #1745. Delete socket only if it exists

* Update jest snapshots to fix last year date text
This commit is contained in:
Chen-I Lim 2022-01-03 10:42:28 -08:00 committed by GitHub
parent b583bae668
commit 5c69c2de57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View file

@ -374,8 +374,11 @@ func (s *Server) startLocalModeServer() error {
}
// TODO: Close and delete socket file on shutdown
if err := syscall.Unlink(s.config.LocalModeSocketLocation); err != nil {
s.logger.Error("Unable to unlink socket.", mlog.Err(err))
// Delete existing socket if it exists
if _, err := os.Stat(s.config.LocalModeSocketLocation); err == nil {
if err := syscall.Unlink(s.config.LocalModeSocketLocation); err != nil {
s.logger.Error("Unable to unlink socket.", mlog.Err(err))
}
}
socket := s.config.LocalModeSocketLocation

View file

@ -5,7 +5,7 @@ exports[`componnets/properties/lastModifiedAt should match snapshot 1`] = `
<div
class="LastModifiedAt octo-propertyvalue readonly"
>
June 15, 4:22 PM
June 15, 2021, 4:22 PM
</div>
</div>
`;

View file

@ -219,7 +219,7 @@ exports[`components/table/Table extended should match snapshot with CreatedBy 1`
<div
class="CreatedAt octo-propertyvalue readonly"
>
June 15, 4:22 PM
June 15, 2021, 4:22 PM
</div>
</div>
</div>
@ -307,7 +307,7 @@ exports[`components/table/Table extended should match snapshot with CreatedBy 1`
<div
class="CreatedAt octo-propertyvalue readonly"
>
June 15, 4:22 PM
June 15, 2021, 4:22 PM
</div>
</div>
</div>
@ -995,7 +995,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
<div
class="LastModifiedAt octo-propertyvalue readonly"
>
June 20, 12:22 PM
June 20, 2021, 12:22 PM
</div>
</div>
</div>
@ -1083,7 +1083,7 @@ exports[`components/table/Table extended should match snapshot with UpdatedAt 1`
<div
class="LastModifiedAt octo-propertyvalue readonly"
>
June 22, 11:23 AM
June 22, 2021, 11:23 AM
</div>
</div>
</div>