Changeset 35415
- Timestamp:
- 2021-09-17T16:41:40+12:00 (3 years ago)
- Location:
- gs2-extensions/open-office/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/open-office/trunk/src/perllib/plugins/OpenOfficeConverter.pm
r32323 r35415 100 100 $status = system("which soffice >nul 2>&1"); # which.exe should be in bin/windows 101 101 if ($status == 0) { 102 $cmd = "start \"soffice process\" $cmd >nul 2>&1"; # order of >nul and 2>&1 matters, see below 102 #$cmd = "start \"soffice process\" $cmd >nul 2>&1"; # order of >nul and 2>&1 matters, see below 103 104 # On Windows, when perl/C/C++ uses system() to launch any standalone process in the background 105 # with "start \"window title\" cmd", perl's child process (despite being mostly independent/detached 106 # from perl) *appears* to share stdout/stderr (stdin) streams with the parent perl process. This is 107 # noticeable with perl launching soffice or any program that neither writes to stderr/out nor sends 108 # eof/eos to indicate parent perl's streams are closed (e.g. Notepad). 109 # This is *not* a problem when perl scripts are run from command line. Command line programs run fine. 110 # But when combined with SafeProcess used by GLI, such silent standalone programs like soffice 111 # cause GLI to hang every time right until the silent program's terminated, because SafeProcess' join() 112 # calls on the perl child process' stderr and stdout block at SafeProcess.InputStreamGobbler.readLine(), 113 # because these stderr/out streams didn't receive eof/eos, implying the silent grandchild process 114 # somehow kept them open. 115 # This is true at Windows/C's system() command level: InputStreamGobblers using join() calls (as SafeProcess 116 # does), combined with a c++ program that uses system() that launches something like Notepad, just all block 117 # until Notepad is closed. 118 # When perl calls a custom java BackgroundLauncher.java program to launch an external program with Runtime.exec(), 119 # this hanging problem doesn't happen as java's exec() is not implemented with Windows C's system(). 120 # Similarly, a WScript file (vbs or js script) that uses WinScriptHost.Run method to run an external program 121 # also doesn't exhibit this problem. So we use a custom vbs script to launch external programs like soffice in 122 # the background from perl (to avoid having to set up Java or have the java program compiled up by the release-kits, 123 # since perl building scripts are not just run from GLI but are also run directly from the cmd line). 124 125 $cmd = "CScript //Nologo $ENV{'GSDLHOME'}\\bin\\windows\\background-launcher.vbs $cmd"; 126 103 127 #print STDERR "***** Tried to start-up OpenOffice with:\n$cmd\n"; 104 128 }
Note:
See TracChangeset
for help on using the changeset viewer.