Skip to content

Parallel execution within two separate applications not possible #148

@saschagrunert

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. :-/

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