[tex-live] tlmgr still has problems handling spaces in texlive's path

Manuel Pégourié-Gonnard mpg at elzevir.fr
Tue Jun 7 03:18:22 CEST 2011


Le 06/06/2011 03:42, Norbert Preining a écrit :
> On So, 05 Jun 2011, Philipp Stephani wrote:
>> - TLPDB.pm lines 303 & 1359
>> - TLUtils.pm lines 1471, 1891, 2158, 2216, 2251, 2274, 3331
> 
> Easier said then done. Please provide versions of 
> 	system("prog <input >output");
> where prog reads from input and writes to output.
> 
> Portable on all systems.
> 
How about that? I tested it successfully on Unix and Windows.

# run a command with (optional) redirections, without a shell
# arguments: input filename, output filename
# return value: none, but $? is set
sub sys_redir {
    my $in = shift;
    my $out = shift;

    # duplicate file handles
    open my $stdin,  '<&', \*STDIN  or die $!;
    open my $stdout, '>&', \*STDOUT or die $!;

    # possibly tweak them
    if (defined $in) {
      open STDIN,  '<', $in         or die $!;
    }
    if (defined $out) {
      open STDOUT, '>', $out        or die $!;
    }

    # run the command
    system { $_[0] } @_;

    # restore handles
    open STDIN,  '<&', $stdin       or die $!;
    open STDOUT, '>&', $stdout      or die $!;
}

Manuel.


More information about the tex-live mailing list