Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

note to self: windows support #3

Open
skaji opened this issue Jan 2, 2021 · 2 comments
Open

note to self: windows support #3

skaji opened this issue Jan 2, 2021 · 2 comments

Comments

@skaji
Copy link
Owner

skaji commented Jan 2, 2021

It may be possible to support windows if we use IO::Socket::INET + system 1, cmds.

@skaji skaji changed the title memo: windows support note to self: windows support Jan 2, 2021
@zmughal
Copy link

zmughal commented Apr 28, 2021

Hi, I have something like that via IO::Pipely orbital-transfer@de51c60.

However, when I try to make this work with cpm, I have the following issues that need to be addressed orbital-transfer/p5-Orbital-Launch#79.

@skaji
Copy link
Owner Author

skaji commented Apr 28, 2021

Just letting you know:

fork(2) emulation in windows has various limitation and would introduce some "mysterious" issues.
So I will not use fork(2) in windows.

I was thinking something like:

#!/usr/bin/env perl
use strict;
use warnings;

if ($ENV{WORKER_PROCESS}) {
    # This is worker process
    # connect the main process by IO::Socket::INET....
    ...;
    exit;
}

# This is main process

my %pid;
for my $i (1..5) {
    local $ENV{WORKER_PROCESS} = 1;
    my $pid = system {$^X} 1, $^X, $0;
    $pid{$pid}++;
}

# connect worker processes by IO::Socket::INET...
...;

while (%pid) {
    my $pid = wait;
    if (delete $pid{$pid}) {
        # OK
    } else {
        warn "unexpected";
    }
}

It's just an idea, and does not work per se.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants