rschupp / PAR-Packer

(perl) Generate stand-alone executables, perl scripts and PAR files https://metacpan.org/pod/PAR::Packer
Other
48 stars 13 forks source link

pp doesn't work properly in a batch file #45

Closed LeeThompson closed 3 years ago

LeeThompson commented 3 years ago

If you write a batch file to use pp to compile, doesn't exit in a way that allows the batch file to continue.

@echo off
setlocal

if exist "compiled.exe" del "compiled.exe"
echo Compiling
pp -o compiled.exe source.pl
if exist "compiled.exe" echo Success
if not exist "compiled.exe" echo Failed

In this example, after pp is executed there will be no further text (no "Success" or "Failed" message).

If you try to fork it doesn't exit that either:

@echo off
setlocal

if exist "compiled.exe" del "compiled.exe"
echo Compiling
start "Compiling" /d"%cd%" /wait pp -o compiled.exe source.pl
if exist "compiled.exe" echo Success
if not exist "compiled.exe" echo Failed

This will start a new Window for the compiler, after it's done it will just stay at a command prompt, not exiting like it should. (If you type exit in the popup prompt, the batch file will resume in this case but it pretty much is useless for automation.) Oddly adding && exit to the command doesn't help at all.

batch_files.zip

Strawberry Perl (x64) v5.30.2 PAR::Packer 1.052 Windows 10.0.19041.985

UPDATE: Poked around and noticed pp is a batch file so I changed the code to: call pp -o compiled.exe source.pl and now it works properly.

Should probably be documented if nothing else.

rschupp commented 3 years ago

Should probably be documented if nothing else

Almost any "executable" (typically specified in EXE_FILES in Makefile.PL) installed from a CPAN distribution is a batch script on Windows as Windows has no #! convention.