Browse Source

pas2js: compileserver exitcode 1 on ESocketError

mattias 3 years ago
parent
commit
52e30aa332
2 changed files with 14 additions and 4 deletions
  1. 2 2
      utils/pas2js/compileserver.lpi
  2. 12 2
      utils/pas2js/httpcompiler.pp

+ 2 - 2
utils/pas2js/compileserver.lpi

@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <ProjectOptions>
-    <Version Value="11"/>
+    <Version Value="12"/>
     <General>
       <Flags>
         <MainUnitHasCreateFormStatements Value="False"/>
         <MainUnitHasTitleStatement Value="False"/>
         <MainUnitHasScaledStatement Value="False"/>
+        <CompatibilityMode Value="True"/>
       </Flags>
       <SessionStorage Value="InProjectDir"/>
-      <MainUnit Value="0"/>
       <Title Value="compileserver"/>
       <UseAppBundle Value="False"/>
       <ResourceType Value="res"/>

+ 12 - 2
utils/pas2js/httpcompiler.pp

@@ -9,11 +9,13 @@ uses
   {$ifdef unix}baseunix,{$endif}
   sysutils, classes, fpjson, contnrs, syncobjs, fpmimetypes, custhttpapp, inifiles,
   fpwebproxy, webutil, fpwebfile, httproute, httpdefs, dirwatch, Pas2JSFSCompiler,
-  Pas2JSCompilerCfg;
+  Pas2JSCompilerCfg, ssockets;
 
 Const
   nErrTooManyThreads = -1;
 
+  nExitCodeSocketError = 1;
+
 Type
   TDirWatcher = Class;
   THTTPCompilerApplication = Class;
@@ -813,7 +815,15 @@ begin
   TSimpleFileModule.RegisterDefaultRoute;
   if InterfaceAddress<>'' then
     HTTPHandler.Address:=InterfaceAddress;
-  inherited;
+  try
+    inherited DoRun;
+  except
+    on E: ESocketError do begin
+      Log(etError,E.ClassName+': '+E.Message);
+      ExitCode:=nExitCodeSocketError;
+      Terminate;
+    end;
+  end;
 end;
 
 end.