Running job in the background from Perl WITHOUT waiting for return

后端 未结 5 946
盖世英雄少女心
盖世英雄少女心 2020-12-06 07:16

The Disclaimer

First of all, I know this question (or close variations) have been asked a thousand times. I really spent a few hours looking in the obvious and the

5条回答
  •  我在风中等你
    2020-12-06 07:25

    Use fork() and then call system in the child process.

    my $pid = fork();
    if (defined $pid && $pid == 0) {
        # child
        system($command);    # or exec($command)
        exit 0;
    }
    # parent
    # ... continue ...
    

提交回复
热议问题