You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
destination_languages de fr es ja ko zh-Hans
callback_plugins
{
:out
{
plugin run_command
data
{
command echo '%OUTFILE%' | sed "s|^$(pwd)/||" >> /root/out.log
}
}
}
In the run_command.pm file, the $command variable is overwritten. You can fix this by changing
subprocess_then_block {
my ($self, $phase, $block, $file, $lang, $strref) = @_;
die"This plugin should only be used in 'after_save_localized_file' phase (current phase: '$phase')"unless$phaseeq'after_save_localized_file';
my$outfile = $self->{parent}->{engine}->get_full_output_path($file, $lang);
($_, my$outpath, $_) = fileparse($outfile); # this way $outpath will include the trailing delimiterforeachmy$command (@{$block->{command}}) {
# substitute %FILE% and target language-based macros# with the full path to the saved file$command = subst_macros($command, $file, $lang);
# substitute %OUTFILE% macro with the full path to the saved file$command =~ s/%OUTFILE%/$outfile/sg;
# substitute %OUTPATH% macro with the full directory path$command =~ s/%OUTPATH%/$outpath/sg;
die"After macro substitution, 'command' parameter evaluates to an empty string"if$commandeq'';
print"RUN: $command\n";
system($command);
my$error_code = unpack'c', pack'C', $? >> 8; # error codedie"Exit code: $error_code\n"if$error_code != 0;
}
return (shift@_)->SUPER::process_then_block(@_);
}
to
subprocess_then_block {
my ($self, $phase, $block, $file, $lang, $strref) = @_;
die"This plugin should only be used in 'after_save_localized_file' phase (current phase: '$phase')"unless$phaseeq'after_save_localized_file';
my$outfile = $self->{parent}->{engine}->get_full_output_path($file, $lang);
($_, my$outpath, $_) = fileparse($outfile); # this way $outpath will include the trailing delimiterforeachmy$command (@{$block->{command}}) {
# substitute %FILE% and target language-based macros# with the full path to the saved filemy$runcmd = subst_macros($command, $file, $lang);
# substitute %OUTFILE% macro with the full path to the saved file$runcmd =~ s/%OUTFILE%/$outfile/sg;
# substitute %OUTPATH% macro with the full directory path$runcmd =~ s/%OUTPATH%/$outpath/sg;
die"After macro substitution, 'command' parameter evaluates to an empty string"if$runcmdeq'';
print"RUN: $runcmd\n";
system($runcmd);
my$error_code = unpack'c', pack'C', $? >> 8; # error codedie"Exit code: $error_code\n"if$error_code != 0;
}
return (shift@_)->SUPER::process_then_block(@_);
}
simple run_command plugin like this:
produce output:
The text was updated successfully, but these errors were encountered: