From 92e1e09a6988eae7d7f745843e7709e8b72b5808 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 26 Jun 2014 10:24:32 -0700 Subject: [PATCH] main: fix the help output to show up --- builtin/providers/aws/resources.go | 5 ++--- main.go | 12 +++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/builtin/providers/aws/resources.go b/builtin/providers/aws/resources.go index bbc83c8ca..6aecab05c 100644 --- a/builtin/providers/aws/resources.go +++ b/builtin/providers/aws/resources.go @@ -38,11 +38,11 @@ func resource_aws_instance_create( // properly. rs := s.MergeDiff(d) + // Create the instance runOpts := &ec2.RunInstances{ ImageId: rs.Attributes["ami"], InstanceType: rs.Attributes["instance_type"], } - log.Printf("[DEBUG] Run configuration: %#v", runOpts) runResp, err := ec2conn.RunInstances(runOpts) if err != nil { @@ -52,8 +52,7 @@ func resource_aws_instance_create( instance := &runResp.Instances[0] log.Printf("[INFO] Instance ID: %s", instance.InstanceId) - // Store the resource state now so that we can return it in the case - // of any errors. + // Store the resulting ID so we can look this up later rs.ID = instance.InstanceId // Wait for the instance to become running so we can get some attributes diff --git a/main.go b/main.go index dabc2e084..31c0d5aed 100644 --- a/main.go +++ b/main.go @@ -100,9 +100,10 @@ func wrappedMain() int { } cli := &cli.CLI{ - Args: args, - Commands: Commands, - HelpFunc: cli.BasicHelpFunc("terraform"), + Args: args, + Commands: Commands, + HelpFunc: cli.BasicHelpFunc("terraform"), + HelpWriter: os.Stdout, } exitCode, err := cli.Run() @@ -131,7 +132,12 @@ func copyOutput(r io.Reader) { if err != nil { panic(err) } + defaultR, err := pr.Prefix("") + if err != nil { + panic(err) + } go io.Copy(os.Stderr, stderrR) go io.Copy(os.Stdout, stdoutR) + go io.Copy(os.Stdout, defaultR) }