feat: implement exec and forward commands for running commands in sandboxes
- Added `exec` command to run a shell or command in a running sandbox, utilizing a new exec server. - Introduced `forward` command to expose ports of a running sandbox on the host's localhost. - Updated Cargo.toml and Cargo.lock to reflect version bump and new dependencies. - Enhanced README.md with usage instructions for new commands. - Refactored build.rs to include new guest helper files for exec functionality. - Created new source files for exec and forward logic, including protocol handling and connection management.
This commit is contained in:
@@ -2,17 +2,20 @@
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=guest/fwd.go");
|
||||
let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("wsbx-fwd");
|
||||
const SRC: [&str; 2] = ["guest/fwd.go", "guest/exec.go"];
|
||||
for f in SRC {
|
||||
println!("cargo:rerun-if-changed={f}");
|
||||
}
|
||||
let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("wsbx-guest");
|
||||
let ok = Command::new("go")
|
||||
.args(["build", "-trimpath", "-ldflags=-s -w", "-o"])
|
||||
.arg(&out)
|
||||
.arg("guest/fwd.go")
|
||||
.args(SRC)
|
||||
.env("GOOS", "linux")
|
||||
.env("GOARCH", "arm64")
|
||||
.env("CGO_ENABLED", "0")
|
||||
.status()
|
||||
.expect("Go is required to build the guest helper (brew install go)")
|
||||
.success();
|
||||
assert!(ok, "go build guest/fwd.go failed");
|
||||
assert!(ok, "go build guest helper failed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user