Skip to content

Parallel execution within two separate applications not possible#148

Description

@saschagrunert

Hey there 馃憢 I know that pb does not have any support for parallel exectuion, but when running two dedicated applications in parallel the ioctl on /dev/tty

pb/pb_x.go

Line 77 in f907f6f

if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newTermios); err != nil {

blocks which cause that they will never finish. So when running this with a simple go run main.go works fine:

package main

import (
	"github.com/cheggaaa/pb"
)

func main() {
	pool := pb.NewPool(&pb.ProgressBar{})

	if err := pool.Start(); err != nil {
		return
	}

	if err := pool.Stop(); err != nil {
		return
	}
}

But running this application in parallel blocks and will never finish, which should happen because both processes sharing the same /dev/tty:

> echo go run main.go > commands
> echo go run main.go >> commands
> parallel < commands
[wait]

I think this issue could be fixed with some system wide mutex but I'm not sure if this is a nice solution. :-/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions