mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 10:29:24 +02:00
* shell now returns an exitcode
* print an error if linking failed when linking was done using a script
This commit is contained in:
parent
dbedc97141
commit
75c3c8b259
@ -302,7 +302,7 @@ interface
|
|||||||
function FindExe(const bin:string;var foundfile:string):boolean;
|
function FindExe(const bin:string;var foundfile:string):boolean;
|
||||||
function GetShortName(const n:string):string;
|
function GetShortName(const n:string):string;
|
||||||
|
|
||||||
Procedure Shell(const command:string);
|
function Shell(const command:string): longint;
|
||||||
function GetEnvPChar(const envname:string):pchar;
|
function GetEnvPChar(const envname:string):pchar;
|
||||||
procedure FreeEnvPChar(p:pchar);
|
procedure FreeEnvPChar(p:pchar);
|
||||||
|
|
||||||
@ -1326,17 +1326,21 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Procedure Shell(const command:string);
|
function Shell(const command:string): longint;
|
||||||
{ This is already defined in the linux.ppu for linux, need for the *
|
{ This is already defined in the linux.ppu for linux, need for the *
|
||||||
expansion under linux }
|
expansion under linux }
|
||||||
{$ifdef hasunix}
|
{$ifdef hasunix}
|
||||||
begin
|
begin
|
||||||
{$ifdef havelinuxrtl10}Linux{$else}Unix{$endif}.Shell(command);
|
result := {$ifdef havelinuxrtl10}Linux{$else}Unix{$endif}.Shell(command);
|
||||||
end;
|
end;
|
||||||
{$else}
|
{$else}
|
||||||
{$ifdef amiga}
|
{$ifdef amiga}
|
||||||
begin
|
begin
|
||||||
exec('',command);
|
exec('',command);
|
||||||
|
if (doserror <> 0) then
|
||||||
|
result := doserror
|
||||||
|
else
|
||||||
|
result := dosexitcode;
|
||||||
end;
|
end;
|
||||||
{$else}
|
{$else}
|
||||||
var
|
var
|
||||||
@ -1344,6 +1348,10 @@ implementation
|
|||||||
begin
|
begin
|
||||||
comspec:=getenv('COMSPEC');
|
comspec:=getenv('COMSPEC');
|
||||||
Exec(comspec,' /C '+command);
|
Exec(comspec,' /C '+command);
|
||||||
|
if (doserror <> 0) then
|
||||||
|
result := doserror
|
||||||
|
else
|
||||||
|
result := dosexitcode;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -1905,7 +1913,11 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.132 2004-07-05 23:28:24 olle
|
Revision 1.133 2004-07-17 15:51:57 jonas
|
||||||
|
* shell now returns an exitcode
|
||||||
|
* print an error if linking failed when linking was done using a script
|
||||||
|
|
||||||
|
Revision 1.132 2004/07/05 23:28:24 olle
|
||||||
+ FixFileName now handles Mac OS paths
|
+ FixFileName now handles Mac OS paths
|
||||||
|
|
||||||
Revision 1.131 2004/06/20 08:55:29 florian
|
Revision 1.131 2004/06/20 08:55:29 florian
|
||||||
|
@ -479,17 +479,20 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
Function TExternalLinker.DoExec(const command,para:string;showinfo,useshell:boolean):boolean;
|
Function TExternalLinker.DoExec(const command,para:string;showinfo,useshell:boolean):boolean;
|
||||||
|
var
|
||||||
|
exitcode: longint;
|
||||||
begin
|
begin
|
||||||
DoExec:=true;
|
DoExec:=true;
|
||||||
if not(cs_link_extern in aktglobalswitches) then
|
if not(cs_link_extern in aktglobalswitches) then
|
||||||
begin
|
begin
|
||||||
if useshell then
|
if useshell then
|
||||||
shell(maybequoted(command)+' '+para)
|
exitcode := shell(maybequoted(command)+' '+para)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
swapvectors;
|
swapvectors;
|
||||||
exec(command,para);
|
exec(command,para);
|
||||||
swapvectors;
|
swapvectors;
|
||||||
|
exitcode := dosexitcode;
|
||||||
end;
|
end;
|
||||||
if (doserror<>0) then
|
if (doserror<>0) then
|
||||||
begin
|
begin
|
||||||
@ -498,7 +501,7 @@ begin
|
|||||||
DoExec:=false;
|
DoExec:=false;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (dosexitcode<>0) then
|
if (exitcode<>0) then
|
||||||
begin
|
begin
|
||||||
Message(exec_e_error_while_linking);
|
Message(exec_e_error_while_linking);
|
||||||
aktglobalswitches:=aktglobalswitches+[cs_link_extern];
|
aktglobalswitches:=aktglobalswitches+[cs_link_extern];
|
||||||
@ -676,7 +679,11 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.42 2004-06-20 08:55:29 florian
|
Revision 1.43 2004-07-17 15:51:57 jonas
|
||||||
|
* shell now returns an exitcode
|
||||||
|
* print an error if linking failed when linking was done using a script
|
||||||
|
|
||||||
|
Revision 1.42 2004/06/20 08:55:29 florian
|
||||||
* logs truncated
|
* logs truncated
|
||||||
|
|
||||||
Revision 1.41 2004/02/24 00:53:49 olle
|
Revision 1.41 2004/02/24 00:53:49 olle
|
||||||
|
Loading…
Reference in New Issue
Block a user