Skip to content

Commit

Permalink
Merge pull request #15866 from boaz0/closes_15746
Browse files Browse the repository at this point in the history
Fix podman-remote run --attach stdin to show container ID
  • Loading branch information
openshift-merge-robot authored Sep 21, 2022
2 parents 30231d0 + 377773a commit fea3253
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/domain/infra/tunnel/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,9 @@ func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrID s
}

func startAndAttach(ic *ContainerEngine, name string, detachKeys *string, input, output, errput *os.File) error {
if output == nil && errput == nil {
fmt.Printf("%s\n", name)
}
attachErr := make(chan error)
attachReady := make(chan bool)
options := new(containers.AttachOptions).WithStream(true)
Expand Down
10 changes: 10 additions & 0 deletions test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -892,4 +892,14 @@ $IMAGE--c_ok" \
run_podman container rm -f -t 0 c_ok c_fail_no_rm
}

@test "podman run --attach stdin prints container ID" {
ctr_name="container-$(random_string 5)"
run_podman run --name $ctr_name --attach stdin $IMAGE echo hello
run_output=$output
run_podman inspect --format "{{.Id}}" $ctr_name
ctr_id=$output
is "$run_output" "$ctr_id" "Did not find container ID in the output"
run_podman rm $ctr_name
}

# vim: filetype=sh

0 comments on commit fea3253

Please sign in to comment.