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

Commit4ce1448

Browse files
authored
fix(cli): generate correctly named file in DumpHandler (#12409)
1 parentafcea74 commit4ce1448

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

‎cli/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (r *RootCmd) workspaceAgent() *clibase.Cmd {
149149

150150
// DumpHandler does signal handling, so we call it after the
151151
// reaper.
152-
goDumpHandler(ctx)
152+
goDumpHandler(ctx,"agent")
153153

154154
logWriter:=&lumberjackWriteCloseFixer{w:&lumberjack.Logger{
155155
Filename:filepath.Join(logDir,"coder-agent.log"),

‎cli/root.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ func (r *RootCmd) Verbosef(inv *clibase.Invocation, fmtStr string, args ...inter
937937
// A SIGQUIT handler will not be registered if GOTRACEBACK=crash.
938938
//
939939
// On Windows this immediately returns.
940-
funcDumpHandler(ctx context.Context) {
940+
funcDumpHandler(ctx context.Context,namestring) {
941941
ifruntime.GOOS=="windows" {
942942
// free up the goroutine since it'll be permanently blocked anyways
943943
return
@@ -992,7 +992,11 @@ func DumpHandler(ctx context.Context) {
992992
iferr!=nil {
993993
dir=os.TempDir()
994994
}
995-
fpath:=filepath.Join(dir,fmt.Sprintf("coder-agent-%s.dump",time.Now().Format("2006-01-02T15:04:05.000Z")))
995+
// Make the time filesystem-safe, for example ":" is not
996+
// permitted on many filesystems. Note that Z here only appends
997+
// Z to the string, it does not actually change the time zone.
998+
filesystemSafeTime:=time.Now().UTC().Format("2006-01-02T15-04-05.000Z")
999+
fpath:=filepath.Join(dir,fmt.Sprintf("coder-%s-%s.dump",name,filesystemSafeTime))
9961000
_,_=fmt.Fprintf(os.Stderr,"writing dump to %q\n",fpath)
9971001

9981002
f,err:=os.Create(fpath)

‎cli/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
289289
cliui.Warnf(inv.Stderr,"YAML support is experimental and offers no compatibility guarantees.")
290290
}
291291

292-
goDumpHandler(ctx)
292+
goDumpHandler(ctx,"coderd")
293293

294294
// Validate bind addresses.
295295
ifvals.Address.String()!="" {

‎enterprise/cli/proxyserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (r *RootCmd) proxyServer() *clibase.Cmd {
119119
defertopCancel()
120120
closers.Add(topCancel)
121121

122-
gocli.DumpHandler(ctx)
122+
gocli.DumpHandler(ctx,"workspace-proxy")
123123

124124
cli.PrintLogo(inv,"Coder Workspace Proxy")
125125
logger,logCloser,err:=clilog.New(clilog.FromDeploymentValues(cfg)).Build(inv)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp