File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -661,7 +661,18 @@ func (api *API) processUpdatedContainersLocked(ctx context.Context, updated code
661
661
662
662
case dc .Container == nil :
663
663
if ! api .devcontainerNames [dc .Name ] {
664
- dc .Name = ""
664
+ // If this is a runtime-detected container, check if we
665
+ // should remove it.
666
+ // TODO(mafredri): Consider using afero.
667
+ if _ , err := os .Stat (dc .WorkspaceFolder ); errors .Is (err , os .ErrNotExist ) {
668
+ // If the workspace folder doesn't exist, we can assume
669
+ // that the devcontainer is no longer valid and should be
670
+ // removed.
671
+ logger .Debug (ctx , "devcontainer workspace folder does not exist, removing devcontainer" )
672
+ delete (api .knownDevcontainers , dc .WorkspaceFolder )
673
+ // TODO(mafredri): Delete the agent if it exists.
674
+ continue
675
+ }
665
676
}
666
677
dc .Status = codersdk .WorkspaceAgentDevcontainerStatusStopped
667
678
dc .Dirty = false
You can’t perform that action at this time.
0 commit comments