当我运行这个 raku 脚本时...
my $proc = run( 'tree', '--du', :out);
$proc.out.slurp(:close).say;
Run Code Online (Sandbox Code Playgroud)
我在 MacOS 上收到此错误...
Malformed UTF-8 near bytes ef b9 5c
Run Code Online (Sandbox Code Playgroud)
......而不是像zsh这样的树输出,这是我想要的......
.
??? 00158825_20210222_0844.csv
??? 1970-Article\ Text-1971-1-2-20210118.docx
??? 1976-Article\ Text-1985-1-2-20210127.docx
??? 2042-Article\ Text-2074-1-10-20210208.pdf
??? 2045-Article\ Text-2076-1-10-20210208.pdf
??? 6.\ Guarantor\ Form\ (A).pdf
Run Code Online (Sandbox Code Playgroud)
我试过slurp(:close, enc=>'utf8-c8')了,错误是一样的。
我也试过...
shell( "tree --du >> .temp.txt" );
my @lines = open(".temp.txt").lines;
dd @lines;
Run Code Online (Sandbox Code Playgroud)
......错误是一样的。
打开 .temp.txt 揭示了这一点......
.
â<94><9c>â<94><80>â<94><80> [ 1016739] True
â<94><9c>â<94><80>â<94><80> [ 9459042241] dir-name
â<94><82>Â Â â<94><9c>â<94><80>â<94><80> [ 188142] Business …Run Code Online (Sandbox Code Playgroud)