Skip to content

Commit

Permalink
Call pas2js correct
Browse files Browse the repository at this point in the history
  • Loading branch information
tcs-ulli committed Dec 12, 2018
1 parent b269206 commit f43f119
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pas2js_build/pas2js_build.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ procedure TPas2JSBuild.FindComponentClass(Reader: TReader;

procedure TPas2JSBuild.DoRun;
var
ErrorMsg: String;
aFile: TStringList;
ErrorMsg,aStr: String;
aFile, sl: TStringList;
aParser: TJSONParser;
aOptions: TJSONObject;
searchResult: TRawByteSearchRec;
aProc: TProcess;
i: Integer;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h','help');
Expand Down Expand Up @@ -112,9 +113,16 @@ procedure TPas2JSBuild.DoRun;
end;

aProc := TProcess.Create(nil);
aProc.CommandLine:='pas2js '+ParamStr(1);
aProc.CommandLine:='pas2js';
for i := 0 to aOptions.Arrays['CustomOptions'].Count-1 do
aProc.CommandLine:=aProc.CommandLine+' '+aOptions.Arrays['CustomOptions'].Strings[i];
aProc.CommandLine:=aProc.CommandLine+' '+ParamStr(ParamCount);
aProc.Options:=aProc.Options+[poWaitOnExit,poUsePipes];
aProc.Execute;
sl := TStringList.Create;
sl.LoadFromStream(AProc.Output);
aProc.Free;
for i := 0 to sl.Count-1 do writeln(sl[i]);
// stop program loop
Terminate;
end;
Expand Down

0 comments on commit f43f119

Please sign in to comment.