Thread
#general
    b

    bored-table-20691

    8 months ago
    In continuation of my adventures with
    local.Command
    (in
    pulumi-command
    ), I’m seeing some odd behavior in regards to
    stderr
    when the command itself fails. Specifically, if my command script fails (exits with a non-zero code), I get this reported on my status:
    Diagnostics:
      command:local:Command (my-script):
        error: exit status 1
    
      pulumi:pulumi:Stack (mystack-dev):
        error: update failed
    But
    stderr
    is never set. Specifically, I’ve tried the following:
    ctx.Export("stdout", cmd.Stdout)
    	ctx.Export("stderr", cmd.Stderr)
    
    	pulumi.All(cmd.Stdout, cmd.Stderr).ApplyT(func(args []interface{}) string {
    		stdout := args[0].(string)
    		stderr := args[1].(string)
    
    		fmt.Println("stdout", stdout)
    		fmt.Println("stderr", stderr)
    
    		return ""
    	})
    But none of this prints out. I also tried just stdout and stderr individually, and no dice. If, however, the command exits successfully (with a zero error code), then stdout/stderr complete successfully. My main use case is one of debugging - I want to know why my script fails and that information exists in
    stderr
    , but I cannot access it in the case I need it, which is when it fails 🙂 Am I doing something wrong?
    OK I see https://github.com/pulumi/pulumi-command/issues/32, and looking at the code, looks like this is expected behavior at the moment.
    g

    great-queen-39697

    8 months ago
    At the moment, yes, the command provider is still in preview, so there are a few more things to address than in other generally available providers. I see you've already voted for the issue and commented; thanks for giving us more information!
    b

    bored-table-20691

    8 months ago
    Thanks Laura.