https://gitlab.synchro.net/main/sbbs/-/commit/5de72e09952321c0bfffb38d
Modified Files:
docs/v322_new.md exec/load/filecontents_lib.js src/sbbs3/filedat.c ftpsrvr.cpp js_system.cpp mailsrvr.cpp sbbsecho.c services.cpp src/xpdev/genwrap.c genwrap.h
Log Message:
Run external commands without flashing a console window on Windows
C's system() runs its command through cmd.exe, and when the calling
process has no console of its own -- a Windows service, sbbsctrl.exe, or anything spawned by them -- cmd.exe allocates one, flashing a window onto
the sysop's desktop. The web server made this obvious: every archive a
web client peeks into with ?view= runs lsar.
New in xpdev:
xp_system() - system(), except that a console-less process spawns
%COMSPEC% /S /C "..." with CREATE_NO_WINDOW instead. A caller that does
have a console still goes through system(), so console output is
unchanged there. Standard handles and handle inheritance are passed
along as system() does (services.cpp hands a native service its socket
that way).
xp_popen() - popen(cmd, "r"), read to EOF, with the captured lines
appended to a str_list_t. On Windows it builds the pipe with
CreateProcess() rather than _popen(), which requires the calling process
to have a console and so has never worked inside a server.
system.popen() consequently works on Windows now and is no longer
documented as UNIX-only, and system.exec() no longer flashes a window.
Given the same treatment: the mail server's external mail processors, the Services' native services, SBBSecho's external programs, and the file-extraction command run for DIZ files. FTP's SITE EXEC loses its
#ifdef and returns the command's output to the client on Windows too.
filecontents_lib.js drops the temp-file redirect it was using to keep
lsar off system.popen() (043587351c9) and captures the output directly.
Co-Authored-By: Claude Opus 5 (1M context) <
noreply@anthropic.com>
--- SBBSecho 3.37-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)