hammer icon indicating copy to clipboard operation
hammer copied to clipboard

Hammer stdout logs do not always match file logs

Open langston-barrett opened this issue 9 years ago • 1 comments

When a build script fails, Hammer logs that failure to its own stdout/stderr. However the "stdout" and "stderr" fields of that log line can be empty while the log files in logs/ are populated with the real stdout and stderr of running the build script. The expected behavior is that these would be identical.

langston-barrett avatar Feb 15 '16 21:02 langston-barrett

Here's some more information that might be helpful while debugging this issue:

Sample spec:

---
name: test
version: 1.2.3
iteration: 1
license: ASL 2.0
description:  a test
url: https://github.com/test/test
vendor: test
type: rpm

targets:
  - src: '{{.BuildRoot}}/{{.Name}}'
    dest: '/usr/bin/{{.Name}}'

scripts:
  build: |
    echo "testing stdout"
    >&2 echo "testing stderr"
    exit 1

Logs:

test ➤ hammer build --log-level=debug
INFO[0000] loading packages                              root=/...
DEBU[0000] loading package                               path=/...
DEBU[0000] starting setup stage                          name=test stage=setup
INFO[0000] finished setup stage                          name=test stage=setup
DEBU[0000] starting build stage                          name=test stage=build
ERRO[0000] build script exited with a non-zero exit code  error=exit status 1 name=test stderr= stdout=
ERRO[0000] could not complete stage                      error=exit status 1 name=test stage=build
test ➤ cat logs/test-2016-06-14T12:50:13+01:00-stdout.log 
testing stdout% 
test ➤ cat logs/test-2016-06-14T12:50:13+01:00-stderr.log 
testing stderr%

langston-barrett avatar Jun 14 '16 11:06 langston-barrett