test: the servers two_user starts get a Windows environment (P11c)
two_user.rs started its flagged servers with env_clear plus a Unix PATH
and HOME, no SystemRoot: on Windows Winsock cannot start without it, so
the --http door failed to bind (the server says so on stderr and serves
its pipes only, which is why "ready" still came). The tests now use the
harness's clean_env, as do evidence.rs's extract and the viewer's
command_line test. main (a8ce2e7d) merged in.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HS8WZziDnyxunC23MUxrLp
This commit is contained in:
1 parent
af0c3e95ec
commit
4a2b327513
3 files changed
+27
-22
No files matched your search
@@ -439,14 +439,12 @@ fn the_backfill_reads_an_old_fixtures_files_once() {
|
||||
// host does.
|
||||
books.stop();
|
||||
let run = || {
|
||||
std::process::Command::new(env!("CARGO_BIN_EXE_wanderbooks"))
|
||||
let mut extract = std::process::Command::new(env!("CARGO_BIN_EXE_wanderbooks"));
|
||||
extract
|
||||
.args(["books", "extract", &books.id, "3", "--root"])
|
||||
.arg(books.home.root())
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin")
|
||||
.env("HOME", books.home.dir.path())
|
||||
.output()
|
||||
.unwrap()
|
||||
.arg(books.home.root());
|
||||
common::clean_env(&mut extract, books.home.dir.path());
|
||||
extract.output().unwrap()
|
||||
};
|
||||
let before = books.journal();
|
||||
let out = run();
|
||||
|
||||
@@ -136,14 +136,14 @@ impl FlaggedServer {
|
||||
.append(true)
|
||||
.open(home.dir.path().join("server.log"))
|
||||
.unwrap();
|
||||
let mut child = Command::new(env!("CARGO_BIN_EXE_wanderbooks"))
|
||||
let mut server = Command::new(env!("CARGO_BIN_EXE_wanderbooks"));
|
||||
server
|
||||
.arg("server")
|
||||
.arg("--root")
|
||||
.arg(home.root())
|
||||
.args(args)
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin")
|
||||
.env("HOME", home.dir.path())
|
||||
.args(args);
|
||||
common::clean_env(&mut server, home.dir.path());
|
||||
let mut child = server
|
||||
.env("XDG_CONFIG_HOME", home.dir.path().join(".config"))
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
@@ -184,14 +184,14 @@ impl Drop for FlaggedServer {
|
||||
/// Run the server with `args` that should be refused before it serves
|
||||
/// anything: its status, stdout and stderr.
|
||||
fn refused_server(home: &Home, args: &[String]) -> std::process::Output {
|
||||
Command::new(env!("CARGO_BIN_EXE_wanderbooks"))
|
||||
let mut server = Command::new(env!("CARGO_BIN_EXE_wanderbooks"));
|
||||
server
|
||||
.arg("server")
|
||||
.arg("--root")
|
||||
.arg(home.root())
|
||||
.args(args)
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin")
|
||||
.env("HOME", home.dir.path())
|
||||
.args(args);
|
||||
common::clean_env(&mut server, home.dir.path());
|
||||
server
|
||||
.env("XDG_CONFIG_HOME", home.dir.path().join(".config"))
|
||||
.output()
|
||||
.unwrap()
|
||||
@@ -240,13 +240,13 @@ fn the_tunnel_door_binds_loopback_only() {
|
||||
}
|
||||
|
||||
// The same refusal through `serve`, before it starts a host at all.
|
||||
let out = Command::new(env!("CARGO_BIN_EXE_wanderbooks"))
|
||||
let mut serve = Command::new(env!("CARGO_BIN_EXE_wanderbooks"));
|
||||
serve
|
||||
.args(["serve", "--root"])
|
||||
.arg(home.root())
|
||||
.args(["--http", "0.0.0.0:0"])
|
||||
.env_clear()
|
||||
.env("PATH", "/usr/bin:/bin")
|
||||
.env("HOME", home.dir.path())
|
||||
.args(["--http", "0.0.0.0:0"]);
|
||||
common::clean_env(&mut serve, home.dir.path());
|
||||
let out = serve
|
||||
.env("XDG_CONFIG_HOME", home.dir.path().join(".config"))
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
@@ -10,6 +10,13 @@ use std::process::Command;
|
||||
fn viewer(home: &std::path::Path) -> Command {
|
||||
let mut c = Command::new(env!("CARGO_BIN_EXE_ledger-gui"));
|
||||
c.env_clear().env("PATH", "/usr/bin:/bin").env("HOME", home);
|
||||
// A Windows program started with no environment at all can't load.
|
||||
#[cfg(windows)]
|
||||
for name in ["SystemRoot", "windir"] {
|
||||
if let Some(value) = std::env::var_os(name) {
|
||||
c.env(name, value);
|
||||
}
|
||||
}
|
||||
c
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user