@@ -247,11 +247,10 @@ func (*agent) collectMetadata(ctx context.Context, md codersdk.WorkspaceAgentMet
247
247
var out bytes.Buffer
248
248
result := & codersdk.WorkspaceAgentMetadataResult {
249
249
// 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.
252
251
//
253
252
// 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 .
255
254
CollectedAt : time .Now (),
256
255
}
257
256
cmd , err := createMetadataCommand (ctx , md .Script )
@@ -264,7 +263,7 @@ func (*agent) collectMetadata(ctx context.Context, md codersdk.WorkspaceAgentMet
264
263
cmd .Stderr = & out
265
264
cmd .Stdin = io .LimitReader (nil , 0 )
266
265
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.
268
267
err = cmd .Start ()
269
268
if err != nil {
270
269
result .Error = fmt .Sprintf ("start cmd: %+v" , err )
@@ -283,7 +282,7 @@ func (*agent) collectMetadata(ctx context.Context, md codersdk.WorkspaceAgentMet
283
282
}
284
283
285
284
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 )
287
286
}
288
287
result .Value = out .String ()
289
288
return result
0 commit comments