crucible nwsync emit and assemble printed their summary line to stdout. Callers that capture a script's stdout as a value got the summary glued onto it: pack-haks.sh does release_dir="$(...)", so all 11 emit summaries landed in $release_dir and publish-release.sh failed with "release dir not found". Neither line is a machine-readable contract, so move both to stderr, where lib.sh's own "nwsync: emitted $key" log already goes. runEmit and runAssemble no longer need the stdout writer. Fixes #81. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,9 +29,9 @@ func Run(args []string, stdout, stderr io.Writer) int {
|
||||
}
|
||||
switch args[0] {
|
||||
case "emit":
|
||||
return runEmit(args[1:], stdout, stderr)
|
||||
return runEmit(args[1:], stderr)
|
||||
case "assemble":
|
||||
return runAssemble(args[1:], stdout, stderr)
|
||||
return runAssemble(args[1:], stderr)
|
||||
case "-h", "--help", "help":
|
||||
printRunUsage(stdout)
|
||||
return exitOK
|
||||
@@ -76,7 +76,7 @@ func parseArgs(fs *flag.FlagSet, args []string) ([]string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func runEmit(args []string, stdout, stderr io.Writer) int {
|
||||
func runEmit(args []string, stderr io.Writer) int {
|
||||
fs := flag.NewFlagSet("emit", flag.ContinueOnError)
|
||||
fs.SetOutput(stderr)
|
||||
as := fs.String("as", "", "published name of the artifact, when it differs from the key")
|
||||
@@ -106,12 +106,12 @@ func runEmit(args []string, stdout, stderr io.Writer) int {
|
||||
fmt.Fprintf(stderr, "nwsync emit: %v\n", err)
|
||||
return exitInternal
|
||||
}
|
||||
fmt.Fprintf(stdout, "emitted %s: %d resources, %d new blobs, index %s\n",
|
||||
fmt.Fprintf(stderr, "emitted %s: %d resources, %d new blobs, index %s\n",
|
||||
result.Name, result.Entries, result.BlobsWritten, result.ManifestPath)
|
||||
return exitOK
|
||||
}
|
||||
|
||||
func runAssemble(args []string, stdout, stderr io.Writer) int {
|
||||
func runAssemble(args []string, stderr io.Writer) int {
|
||||
fs := flag.NewFlagSet("assemble", flag.ContinueOnError)
|
||||
fs.SetOutput(stderr)
|
||||
tlkKey := fs.String("tlk-key", "", "depot key of the TLK, which shadows nothing and merges last")
|
||||
@@ -140,7 +140,7 @@ func runAssemble(args []string, stdout, stderr io.Writer) int {
|
||||
fmt.Fprintf(stderr, "nwsync assemble: %v\n", err)
|
||||
return exitInternal
|
||||
}
|
||||
fmt.Fprintf(stdout, "assembled manifest %s: %d resources, %s\n",
|
||||
fmt.Fprintf(stderr, "assembled manifest %s: %d resources, %s\n",
|
||||
result.SHA1, result.Entries, result.ManifestPath)
|
||||
return exitOK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user