- Timestamp:
- 2017-08-11T18:22:36+12:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/download/DownloadJob.java
r31877 r31878 310 310 Process prcs = null; 311 311 312 313 if (Utility.isWindows()) { 314 prcs = rt.exec(cmd); 312 if (proxy_url != null && !proxy_url.equals("")) { 313 // Specify proxies as environment variables 314 // Need to manually specify GSDLHOME and GSDLOS also 315 316 proxy_url = proxy_url.replaceAll("http://",""); 317 318 env = new String[7]; 319 320 env[0] = "http_proxy=http://"+proxy_url; 321 env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 322 // see also https://wiki.archlinux.org/index.php/proxy_settings 323 env[2] = "ftp_proxy=ftp://"+proxy_url; 324 env[3] = "GSDLHOME=" + Configuration.gsdl_path; 325 env[4] = "GSDLOS=" + Gatherer.client_operating_system; 326 // teach it where the wgetrc file lives, in gs2build/bin/<os>: 327 env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; 328 // Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by 329 // WgetDownload.pm's open3() call is not on the PATH, then the perl open() call to run wget fails. 330 // So make PATH available to get open3() working: 331 env[6] = "PATH="+System.getenv("PATH"); 332 333 prcs = rt.exec(cmd, env); 334 } 335 else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) { 336 // Not Windows, but running client with download panel 337 // Need to manually specify GSDLHOME and GSDLOS 338 env = new String[3]; 339 env[0] = "GSDLHOME=" + Configuration.gsdl_path; 340 env[1] = "GSDLOS=" + Gatherer.client_operating_system; 341 env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 342 prcs = rt.exec(cmd, env); 315 343 } 316 344 else { 317 if (proxy_url != null && !proxy_url.equals("")) { 318 // Specify proxies as environment variables 319 // Need to manually specify GSDLHOME and GSDLOS also 320 env = new String[6]; 321 proxy_url = proxy_url.replaceAll("http://",""); 322 env[0] = "http_proxy=http://"+proxy_url; 323 env[1] = "https_proxy=http://"+proxy_url; // HTTP protocol for https:// too 324 // see also https://wiki.archlinux.org/index.php/proxy_settings 325 env[2] = "ftp_proxy=ftp://"+proxy_url; 326 env[3] = "GSDLHOME=" + Configuration.gsdl_path; 327 env[4] = "GSDLOS=" + Gatherer.client_operating_system; 328 env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 329 prcs = rt.exec(cmd, env); 330 } 331 else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled) { 332 // Not Windows, but running client with download panel 333 // Need to manually specify GSDLHOME and GSDLOS 334 env = new String[3]; 335 env[0] = "GSDLHOME=" + Configuration.gsdl_path; 336 env[1] = "GSDLOS=" + Gatherer.client_operating_system; 337 env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 338 prcs = rt.exec(cmd, env); 339 } 340 else { 341 // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 342 prcs = rt.exec(cmd); 343 } 345 // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 346 prcs = rt.exec(cmd); 344 347 } 345 348 //System.out.println(newcmd); … … 620 623 String [] env = null; 621 624 622 if (proxy_url != null && !proxy_url.equals("")) { 623 // Specify proxies as environment variables 624 // Need to manually specify GSDLHOME and GSDLOS also 625 626 proxy_url = proxy_url.replaceAll("http://",""); 627 628 env = new String[7]; 629 630 env[0] = "http_proxy=http://"+proxy_url; 631 env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 632 // see also https://wiki.archlinux.org/index.php/proxy_settings 633 env[2] = "ftp_proxy=ftp://"+proxy_url; 634 env[3] = "GSDLHOME=" + Configuration.gsdl_path; 635 env[4] = "GSDLOS=" + Gatherer.client_operating_system; 636 env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 637 // If PATH is not made available, so that Perl is not on the PATH, then WgetDownload.pm's open3() call 638 // to run wget fails with cryptic failure message. So make PATH available for open3(): 639 env[6] = "PATH="+System.getenv("PATH"); 640 641 prcs = new SafeProcess(cmd, env, null); 642 } 643 else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) { 644 // Not Windows, but running client with download panel 645 // Need to manually specify GSDLHOME and GSDLOS 646 env = new String[3]; 647 env[0] = "GSDLHOME=" + Configuration.gsdl_path; 648 env[1] = "GSDLOS=" + Gatherer.client_operating_system; 649 env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 650 prcs = new SafeProcess(cmd, env, null); 651 } 652 else { 653 // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 654 prcs = new SafeProcess(cmd); 655 } 656 625 if (proxy_url != null && !proxy_url.equals("")) { 626 // Specify proxies as environment variables 627 // Need to manually specify GSDLHOME and GSDLOS also 628 629 proxy_url = proxy_url.replaceAll("http://",""); 630 631 env = new String[7]; 632 633 env[0] = "http_proxy=http://"+proxy_url; 634 env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 635 // see also https://wiki.archlinux.org/index.php/proxy_settings 636 env[2] = "ftp_proxy=ftp://"+proxy_url; 637 env[3] = "GSDLHOME=" + Configuration.gsdl_path; 638 env[4] = "GSDLOS=" + Gatherer.client_operating_system; 639 // teach it where the wgetrc file lives, in gs2build/bin/<os>: 640 env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; 641 // Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by 642 // WgetDownload.pm's open3() call is not on the PATH, then the perl open() call to run wget fails. 643 // So make PATH available to get open3() working: 644 env[6] = "PATH="+System.getenv("PATH"); 645 646 prcs = new SafeProcess(cmd, env, null); 647 } 648 else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) { 649 // Not Windows, but running client with download panel 650 // Need to manually specify GSDLHOME and GSDLOS 651 env = new String[3]; 652 env[0] = "GSDLHOME=" + Configuration.gsdl_path; 653 env[1] = "GSDLOS=" + Gatherer.client_operating_system; 654 env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 655 prcs = new SafeProcess(cmd, env, null); 656 } 657 else { 658 // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 659 prcs = new SafeProcess(cmd); 660 } 661 657 662 //System.out.println(newcmd); 658 663 prcs.setMainHandler(this); // attach handler to clean up before and after process.destroy()
Note:
See TracChangeset
for help on using the changeset viewer.