mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-14 10:20:21 +02:00
atari: implemented sysutils/ExecuteProcess
git-svn-id: trunk@35208 -
This commit is contained in:
parent
9ce4184dd9
commit
c663c09b7b
@ -133,6 +133,7 @@ function gemdos_tgetdate: longint; syscall 1 42;
|
||||
function gemdos_tgettime: longint; syscall 1 44;
|
||||
|
||||
function gemdos_getdta: PDTA; syscall 1 47;
|
||||
function gemdos_sversion: smallint; syscall 1 48;
|
||||
|
||||
function gemdos_dfree(buf: PDISKINFO; driveno: smallint): smallint; syscall 1 54;
|
||||
|
||||
@ -152,7 +153,7 @@ function gemdos_dgetpath(path: pchar; driveno: smallint): smallint; syscall 1 71
|
||||
function gemdos_malloc(number: dword): pointer; syscall 1 72;
|
||||
function gemdos_free(block: pointer): dword; syscall 1 73;
|
||||
function gemdos_mshrink(zero: word; block: pointer; newsiz: longint): longint; syscall 1 74;
|
||||
|
||||
function gemdos_pexec(mode: word; name: pchar; cmdline: pchar; env: pchar): longint; syscall 1 75;
|
||||
procedure gemdos_pterm(returncode: smallint); syscall 1 76;
|
||||
|
||||
function gemdos_fsfirst(filename: pchar; attr: smallint): longint; syscall 1 78;
|
||||
|
@ -469,9 +469,29 @@ end;
|
||||
|
||||
function ExecuteProcess (const Path: RawByteString; const ComLine: RawByteString;Flags:TExecuteFlags=[]):
|
||||
integer;
|
||||
var
|
||||
tmpPath: RawByteString;
|
||||
pcmdline: ShortString;
|
||||
CommandLine: RawByteString;
|
||||
E: EOSError;
|
||||
begin
|
||||
{writeln('Unimplemented ExecuteProcess');}
|
||||
result:=-1;
|
||||
tmpPath:=ToSingleByteFileSystemEncodedFileName(Path);
|
||||
pcmdline:=ToSingleByteFileSystemEncodedFileName(ComLine);
|
||||
|
||||
{ the zero offset for cmdline is actually correct here. pexec() expects
|
||||
pascal formatted string for cmdline, so length in first byte }
|
||||
result:=gemdos_pexec(0,PChar(tmpPath),@pcmdline[0],nil);
|
||||
|
||||
if result < 0 then begin
|
||||
if ComLine = '' then
|
||||
CommandLine := Path
|
||||
else
|
||||
CommandLine := Path + ' ' + ComLine;
|
||||
|
||||
E := EOSError.CreateFmt (SExecuteProcessFailed, [CommandLine, result]);
|
||||
E.ErrorCode := result;
|
||||
raise E;
|
||||
end;
|
||||
end;
|
||||
|
||||
function ExecuteProcess (const Path: RawByteString;
|
||||
|
Loading…
Reference in New Issue
Block a user