I did a fresh install of Lazarus 1.8.4 (lazarus-1.8.4-fpc-3.0.4-win32.exe) on Windows 10 64 bit.I can confirm both situations on Microsoft Windows 7.
I set the value of "Run parameters - Command line parameters" to: "first second third" (without quotes).
Running this simple program:
program test_params; {$IFDEF FPC} {$MODE DELPHI} {$ELSE} {$APPTYPE CONSOLE} {$ENDIF} var i: Integer; begin for i := 1 to ParamCount do WriteLn('Param(', i, ')=', ParamStr(i)); WriteLn('Press Enter to exit ...'); ReadLn; end.
from Lazarus IDE using "Run" (F9) the output is:
Param(1)=first
Param(2)=second
Param(3)=third
Press Enter to exit ...
wich is what I expect.
But when I run the program using "Run without Debugging" (Shift+Ctrl+F9) the output is:
Param(1)=first second third
Press Enter to exit ...
It seems that in the second case Lazarus IDE will send the content of "Command line parameters" as a single parameter to the executable.
Is this a bug or is it "by design" ?I believe it's a bug because "Run" (F9) and "Run without Debugging" (Shift+Ctrl+F9) should have the same behavior and produce the same output.
Patch attached.Thanks. I applied it in r59168. Please test everybody. It will be merged to 2.0 branch later.
https://bugs.freepascal.org/view.php?id=35649