@@ -428,18 +428,14 @@ std::filesystem::path sandbox_init_marker(const Env& env) {
428428std::string build_command_prefix (const Env& env) {
429429 auto xvmBin = paths::sandbox_bin (env).string ();
430430#if defined(_WIN32)
431- // Windows: set environment variables via _putenv_s (inherited by
432- // child processes) AND cd to the sandbox home (xlings may use cwd
433- // to resolve its home). Return a "cd /d <home> && <binary>" prefix.
434431 _putenv_s (" XLINGS_HOME" , env.home .string ().c_str ());
435432 _putenv_s (" XLINGS_PROJECT_DIR" ,
436433 env.projectDir .empty () ? " " : env.projectDir .string ().c_str ());
437434 {
438435 std::string newPath = xvmBin + " ;" + (std::getenv (" PATH" ) ? std::getenv (" PATH" ) : " " );
439436 _putenv_s (" PATH" , newPath.c_str ());
440437 }
441- return std::format (" cd /d \" {}\" && \" {}\" " ,
442- env.home .string (), env.binary .string ());
438+ return env.binary .string ();
443439#else
444440 if (env.projectDir .empty ()) {
445441 // Global mode: unset XLINGS_PROJECT_DIR (existing behavior).
@@ -663,15 +659,13 @@ int install_with_progress(const Env& env, std::string_view target,
663659 R"( {{"targets":["{}"],"yes":true}})" , target);
664660
665661#if defined(_WIN32)
666- // Ensure xlings sees XLINGS_HOME + runs from the sandbox dir.
667- // Both _putenv_s (inherited by child) and cd /d (working dir) are
668- // needed — xlings may resolve its home from either.
669662 _putenv_s (" XLINGS_HOME" , env.home .string ().c_str ());
670663 _putenv_s (" XLINGS_PROJECT_DIR" , " " );
671664 std::error_code ec_mkdir;
672665 std::filesystem::create_directories (env.home , ec_mkdir);
673- auto cmd = std::format (" cd /d \" {}\" && \" {}\" interface install_packages --args {} 2>nul" ,
674- env.home .string (),
666+ // Use raw command — _putenv_s is inherited by popen child.
667+ // No 2>nul — let xlings output be visible for debugging.
668+ auto cmd = std::format (" {} interface install_packages --args {}" ,
675669 env.binary .string (),
676670 shq (argsJson));
677671#else
@@ -805,8 +799,7 @@ void ensure_init(const Env& env, bool quiet) {
805799#if defined(_WIN32)
806800 _putenv_s (" XLINGS_HOME" , env.home .string ().c_str ());
807801 _putenv_s (" XLINGS_PROJECT_DIR" , " " );
808- auto cmd = std::format (" cd /d \" {}\" && \" {}\" self init" ,
809- env.home .string (), env.binary .string ());
802+ auto cmd = env.binary .string () + " self init" ;
810803#else
811804 auto cmd = std::format (
812805 " cd {} && env -u XLINGS_PROJECT_DIR XLINGS_HOME={} {} self init >/dev/null 2>&1" ,
0 commit comments