Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8c289e5

Browse files
committed
Write startup script logs to fs dir
1 parentfbb1bdb commit8c289e5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

‎agent/agent.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,11 @@ func (a *agent) runStartupScript(ctx context.Context, script string) error {
376376
}
377377

378378
a.logger.Info(ctx,"running startup script",slog.F("script",script))
379-
writer,err:=os.OpenFile(filepath.Join(os.TempDir(),"coder-startup-script.log"),os.O_CREATE|os.O_RDWR,0o600)
379+
tempDir,err:=afero.TempDir(a.filesystem,"","")
380+
iferr!=nil {
381+
returnxerrors.Errorf("create temp dir: %w",err)
382+
}
383+
writer,err:=a.filesystem.OpenFile(filepath.Join(tempDir,"coder-startup-script.log"),os.O_CREATE|os.O_RDWR,0o600)
380384
iferr!=nil {
381385
returnxerrors.Errorf("open startup script log file: %w",err)
382386
}

‎agent/agent_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,7 @@ func setupAgent(t *testing.T, metadata codersdk.WorkspaceAgentMetadata, ptyTimeo
681681
statsChan:statsCh,
682682
coordinator:coordinator,
683683
},
684+
Filesystem:afero.NewMemMapFs(),
684685
Logger:slogtest.Make(t,nil).Leveled(slog.LevelDebug),
685686
ReconnectingPTYTimeout:ptyTimeout,
686687
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp