我正在为另一个应用程序编写 Perl 包装器。
我需要通过管道传输 STDIN 和一些 STDOUT。
Perl 代码
#!/usr/bin/perl -w
use strict;
use IPC::Run3 qw(run3);
my $stdout;
local $| = 1;
run3 ['node','gekko',"-b","-c","BNB-XLM-Doktor_v1-5-144-config.js"], undef, $stdout;
输出
2018-03-18 13:50:10 (DEBUG): Available 142534
2018-03-18 13:50:10 (DEBUG): Optimal 144240
2018-03-18 13:50:10 (INFO): The database has 1707 candles missing, Figuring out which ones...
2018-03-18 13:50:11 (INFO): Gekko detected multiple dateranges in the locally stored history. Please pick the daterange you are interested in testing:
2018-03-18 13:50:11 (INFO): OPTION 1:
2018-03-18 13:50:11 (INFO): from: 2017-12-08 07:04:00
2018-03-18 13:50:11 (INFO): to: 2018-03-14 19:04:00
2018-03-18 13:50:11 (INFO): OPTION 2:
2018-03-18 13:50:11 (INFO): from: 2018-03-16 00:04:00
2018-03-18 13:50:11 (INFO): to: 2018-03-18 10:04:00
prompt: option:
我想实现这个标准输出:
OPTION 1:
from: 2017-12-08 07:04:00
to: 2018-03-14 19:04:00
OPTION 2:
from: 2018-03-16 00:04:00
to: 2018-03-18 10:04:00
prompt: option:
所以 STDOUT 必须被过滤,我不知道怎么做。
我试过了,$stdout =~ s/....//g
但它不起作用。
请记住,在过滤 STDOUT 之后,它也必须从父级向子级发送 STDIN