Klammertext runs natively on Windows; a Windows source-install guide; the bundled sh for @eval :shell
Assembled from klammertext-dev f344a37d772c. The commands, the library,
the Standard Klammer Set, the reflection klammerset and the Python
binding build and run natively on Windows (MSYS2 UCRT64 gcc, python.org
Python), and both test tiers pass there. doc/install/windows_source_install.md
is the fifth install guide: a source install parallel to the Linux and
macOS ones, verified by following it on a pristine Windows 11.
Behaviour on every system: paths Klammertext prints use forward slashes;
output is LF; the command line is UTF-8 on Windows; @eval :shell is a
POSIX shell command everywhere -- on Windows it runs the sh Klammertext
ships, BusyBox for Windows (win/busybox/, GPLv2, with its licence and the
source pointer). KLAMMERTEXT_FONTS and KLAMMERTEXT_KLAMMERSETS are lists in
the system's PATH convention (';' on Windows). On Linux and macOS nothing
observable changes.
This commit is contained in:
1 parent
f9af1ff869
commit
830b19394d
55 files changed
+1182
-153
No files matched your search
+14
-2
@@ -10,7 +10,16 @@
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <unistd.h>
|
||||
#ifdef _WIN32
|
||||
// mingw-w64 has no <sys/wait.h>: there pclose() returns the child's exit code
|
||||
// itself, not a wait status, and no signal can have killed it.
|
||||
#define WIFEXITED(s) ((s) != -1)
|
||||
#define WEXITSTATUS(s) (s)
|
||||
#define WIFSIGNALED(s) 0
|
||||
#define WTERMSIG(s) 0
|
||||
#else
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
// Run a shell command and return its STANDARD OUTPUT, which becomes document
|
||||
// text. Two things the first version did not do, both of them the same defect
|
||||
@@ -51,7 +60,8 @@ std::string shell(State state, std::string command, Locator loc)
|
||||
// The braces keep the redirection outside the writer's command, so a
|
||||
// command containing its own pipeline or redirection still works.
|
||||
std::string wrapped = "{ " + command + " ; } 2>" + q_(err_path);
|
||||
FILE* pipe = popen(wrapped.c_str(), "r");
|
||||
Shell_command sh_cmd(wrapped, loc);
|
||||
FILE* pipe = popen(sh_cmd.line().c_str(), "r");
|
||||
if (!pipe) {
|
||||
fs::remove(err_path);
|
||||
throw Environment_error(
|
||||
@@ -129,7 +139,9 @@ std::string run_haskell(const std::string& hsfile, Locator loc)
|
||||
err_path = err_template.data();
|
||||
|
||||
std::string command = "runghc " + q_(hsfile) + " 2>" + q_(err_path);
|
||||
FILE* pipe = popen(command.c_str(), "r");
|
||||
// Through the same sh as :shell: the quoting is sh quoting.
|
||||
Shell_command sh_cmd(command, loc);
|
||||
FILE* pipe = popen(sh_cmd.line().c_str(), "r");
|
||||
if (!pipe) {
|
||||
fs::remove(err_path);
|
||||
throw Environment_error("Could not run runghc.", loc);
|
||||
|
||||
Reference in new issue
Block a user