Skip to content

Commit 62a76f4

Browse files
committed
log shell
1 parent 2bdbb55 commit 62a76f4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

agent/agent.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,10 @@ func (*agent) collectMetadata(ctx context.Context, md codersdk.WorkspaceAgentMet
247247
var out bytes.Buffer
248248
result := &codersdk.WorkspaceAgentMetadataResult{
249249
// CollectedAt is set here for testing purposes and overrode by
250-
// the server to the time the server received the result to protect
251-
// against clock skew.
250+
// coderd to the time of server receipt to solve clock skew.
252251
//
253252
// In the future, the server may accept the timestamp from the agent
254-
// if it is certain the clocks are in sync.
253+
// if it can guarantee the clocks are synchronized.
255254
CollectedAt: time.Now(),
256255
}
257256
cmd, err := createMetadataCommand(ctx, md.Script)
@@ -264,7 +263,7 @@ func (*agent) collectMetadata(ctx context.Context, md codersdk.WorkspaceAgentMet
264263
cmd.Stderr = &out
265264
cmd.Stdin = io.LimitReader(nil, 0)
266265

267-
// We split up Start and Wait so that we can return a more useful error.
266+
// We split up Start and Wait instead of calling Run so that we can return a more precise error.
268267
err = cmd.Start()
269268
if err != nil {
270269
result.Error = fmt.Sprintf("start cmd: %+v", err)
@@ -283,7 +282,7 @@ func (*agent) collectMetadata(ctx context.Context, md codersdk.WorkspaceAgentMet
283282
}
284283

285284
if err != nil {
286-
result.Error = fmt.Sprintf("run cmd: %+v", err)
285+
result.Error = fmt.Sprintf("run cmd (shell %v): %+v", cmd.Path, err)
287286
}
288287
result.Value = out.String()
289288
return result

0 commit comments

Comments
 (0)