Skip to content

Commit

Permalink
report time in log output
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Apr 18, 2017
1 parent 36f12ab commit d5c106b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.3.8
=====
+ report time in log output

0.3.7
=====
+ compress temporary files with gzip (BestSpeed)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
rm -rf binaries
mkdir -p binaries/
VERSION=0.3.3
VERSION=0.3.8
for os in darwin linux windows; do
GOOS=$os GOARCH=$arch go build -o binaries/gargs_${os} main.go
done
Expand Down Expand Up @@ -131,7 +131,7 @@ Usage

via `gargs -h`
```
gargs 0.3.6
gargs 0.3.8
usage: gargs [--procs PROCS] [--sep SEP] [--nlines NLINES] [--retry RETRY] [--ordered] [--verbose] [--stop-on-error] [--dry-run] [--log LOG] COMMAND
positional arguments:
Expand Down
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

// Version is the current version
const Version = "0.3.7"
const Version = "0.3.8"

// ExitCode is the highest exit code seen in any command
var ExitCode = 0
Expand Down Expand Up @@ -224,10 +224,11 @@ func run(args Params) {
}
if args.log != nil {
// if no error prefix the command with '#'
rtime := fmt.Sprintf("#\t%s\n", p.Duration.Seconds())
if p.ExitCode() == 0 {
args.log.WriteString("# " + strings.Replace(p.CmdStr, "\n", "\n# ", -1) + "\n")
args.log.WriteString("# " + strings.Replace(p.CmdStr, "\n", "\n# ", -1) + rtime)
} else {
args.log.WriteString(p.CmdStr + "\n")
args.log.WriteString(p.CmdStr + rtime)
}
stdout.Flush()
}
Expand Down

0 comments on commit d5c106b

Please sign in to comment.