Skip to content

How to know whether a harness is started #171

Open
@nrdvana

Description

@nrdvana

I have a situation where I want a generic function that finishes a harness and reports its result, but doesn't know if the caller started the harness yet. The module seems to be missing a "->started" accessor.

I can almost achieve this with 'pump', but that has the chance of throwing an exception if a pipe is broken.

From the code in pump, there is:

$self->start if $self->{STATE} < _started;
croak "process ended prematurely" unless $self->pumpable;

$self->{auto_close_ins} = 0;
$self->{break_on_io}    = 1;
$self->_select_loop;
return $self->pumpable;

I basically just want public access to that first line, and then call ->finish

Would you accept a PR for essentially this?

sub started { $self->{STATE} >= _started }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions