╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ net.zig ──────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1165 } 1166 1167 fn testFetchLarge( 1168 comptime repo_kind: rp.RepoKind, 1169 comptime transport_def: net.TransportDefinition, 1170 comptime shell_out_to_git: bool, 1171 comptime port: u16, 1172 io: std.Io, 1173 allocator: std.mem.Allocator, 1174 ) !void { 1175 const temp_dir_name = "temp-testnet-fetch-large"; 1176 1177 // create the temp dir 1178 const cwd = std.Io.Dir.cwd(); 1179 var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); 1180 if (temp_dir_or_err) |*temp_dir| { 1181 temp_dir.close(io); 1182 try cwd.deleteTree(io, temp_dir_name); 1183 } else |_| {} 1184 var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); 1185 defer cwd.deleteTree(io, temp_dir_name) catch {}; 1186 defer temp_dir.close(io); 1187 1188 // init server 1189 var server_process = try runServer(io, allocator, temp_dir_name, port); 1190 defer _ = server_process.kill(io); 1191 1192 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1193 defer allocator.free(cwd_path); 1194 1195 // register the repo under admin and locate its on-disk directory 1196 const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; 1197 defer allocator.free(server_path); 1198 1199 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path }); 1200 defer server_repo.deinit(io, allocator); 1201 1202 var server_dir = try cwd.openDir(io, server_path, .{}); 1203 defer server_dir.close(io); 1204 1205 // copy files from current repo into server dir 1206 for (&[_][]const u8{"src"}) |dir_name| { 1207 var src_repo_dir = try cwd.openDir(io, dir_name, .{ .iterate = true }); 1208 defer src_repo_dir.close(io); 1209 1210 var dest_repo_dir = try server_dir.createDirPathOpen(io, dir_name, .{}); 1211 defer dest_repo_dir.close(io); 1212 1213 try copyDir(io, src_repo_dir, dest_repo_dir); 1214 1215 try server_repo.add(io, allocator, &.{dir_name}); 1216 } 1217 1218 // make a commit 1219 const commit1 = try server_repo.commit(io, allocator, .{ .message = "let there be light" }); 1220 1221 // export server repo 1222 { 1223 const export_file = try server_repo.core.repo_dir.createFile(io, "git-daemon-export-ok", .{}); 1224 defer export_file.close(io); 1225 } 1226 1227 if (shell_out_to_git) { 1228 try server_repo.addConfig(io, allocator, .{ .name = "uploadpack.allowrefinwant", .value = "true" }); 1229 } 1230 1231 const client_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "client" }); 1232 defer allocator.free(client_path); 1233 1234 var client_repo = try rp.Repo(repo_kind, .{ .is_test = true }).init(io, allocator, .{ .path = client_path }); 1235 defer client_repo.deinit(io, allocator); 1236 1237 // add remote 1238 { 1239 const remote_url = try remoteUrl(transport_def, allocator, "testrepo", port); 1240 defer allocator.free(remote_url); 1241 1242 try client_repo.addRemote(io, allocator, .{ .name = "origin", .value = remote_url }); 1243 try client_repo.addConfig(io, allocator, .{ .name = "branch.master.remote", .value = "origin" }); 1244 } 1245 1246 const is_ssh = switch (transport_def) { 1247 .file => false, 1248 .wire => |wire_kind| .ssh == wire_kind, 1249 }; 1250 1251 if (shell_out_to_git) { 1252 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); 1253 defer allocator.free(priv_key_path); 1254 const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{ port + 1, priv_key_path }); 1255 defer allocator.free(ssh_config_arg); 1256 1257 { 1258 var process = try std.process.spawn(io, .{ 1259 .argv = if (is_ssh) 1260 &.{ "git", "-c", ssh_config_arg, "pull", "origin", "master" } 1261 else 1262 &.{ "git", "pull", "origin", "master" }, 1263 .cwd = .{ .path = client_path }, 1264 .stdin = .ignore, 1265 .stdout = .ignore, 1266 .stderr = .ignore, 1267 }); 1268 const term = try process.wait(io); 1269 if (term != .exited or term.exited != 0) { 1270 return error.GitCommandFailed; 1271 } 1272 } 1273 1274 // make sure pull was successful 1275 { 1276 const oid_master = (try client_repo.readRef(io, .{ .kind = .head, .name = "master" })).?; 1277 try std.testing.expectEqualStrings(&commit1, &oid_master); 1278 } 1279 1280 // make another commit on the server 1281 const commit2 = blk: { 1282 const extra_txt = try server_repo.core.work_dir.createFile(io, "extra.txt", .{ .truncate = true }); 1283 defer extra_txt.close(io); 1284 try extra_txt.writeStreamingAll(io, "extra content"); 1285 try server_repo.add(io, allocator, &.{"extra.txt"}); 1286 break :blk try server_repo.commit(io, allocator, .{ .message = "add extra file" }); 1287 }; 1288 1289 // fetch with ref-in-want (git uses want-ref in protocol v2 when fetching named refs) 1290 { 1291 var process = try std.process.spawn(io, .{ 1292 .argv = if (is_ssh) 1293 &.{ "git", "-c", ssh_config_arg, "fetch", "origin", "master" } 1294 else 1295 &.{ "git", "fetch", "origin", "master" }, 1296 .cwd = .{ .path = client_path }, 1297 .stdin = .ignore, 1298 .stdout = .ignore, 1299 .stderr = .ignore, 1300 }); 1301 const term = try process.wait(io); 1302 if (term != .exited or term.exited != 0) { 1303 return error.GitCommandFailed; 1304 } 1305 } 1306 1307 // make sure fetch with want-ref was successful 1308 { 1309 const oid_remote_master = (try client_repo.readRef(io, .{ .kind = .{ .remote = "origin" }, .name = "master" })).?; 1310 try std.testing.expectEqualStrings(&commit2, &oid_remote_master); 1311 } 1312 } else { 1313 const refspecs = &.{ 1314 "+refs/heads/master:refs/heads/master", 1315 }; 1316 1317 const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name, port); 1318 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); 1319 1320 try client_repo.fetch( 1321 io, 1322 allocator, 1323 "origin", 1324 .{ .refspecs = refspecs, .wire = .{ .ssh = .{ 1325 .command = ssh_cmd_maybe, 1326 } } }, 1327 ); 1328 1329 // update the working dir 1330 try client_repo.restore(io, allocator, "."); 1331 } 1332 1333 // make sure fetch was successful 1334 { 1335 const oid_master = (try client_repo.readRef(io, .{ .kind = .head, .name = "master" })).?; 1336 try std.testing.expectEqualStrings(&commit1, &oid_master); 1337 } 1338 } 1339 1340 fn testPushLarge( 1341 comptime repo_kind: rp.RepoKind, 1342 comptime transport_def: net.TransportDefinition, 1343 comptime shell_out_to_git: bool, 1344 comptime port: u16, 1345 io: std.Io, 1346 allocator: std.mem.Allocator, 1347 ) !void { 1348 const temp_dir_name = "temp-testnet-push-large"; 1349 1350 // create the temp dir 1351 const cwd = std.Io.Dir.cwd(); 1352 var temp_dir_or_err = cwd.openDir(io, temp_dir_name, .{}); 1353 if (temp_dir_or_err) |*temp_dir| { 1354 temp_dir.close(io); 1355 try cwd.deleteTree(io, temp_dir_name); 1356 } else |_| {} 1357 var temp_dir = try cwd.createDirPathOpen(io, temp_dir_name, .{}); 1358 defer cwd.deleteTree(io, temp_dir_name) catch {}; 1359 defer temp_dir.close(io); 1360 1361 // init server 1362 var server_process = try runServer(io, allocator, temp_dir_name, port); 1363 defer _ = server_process.kill(io); 1364 1365 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1366 defer allocator.free(cwd_path); 1367 1368 // register the repo under admin and locate its on-disk directory 1369 const server_path = (try repoOnDiskPath(io, allocator, temp_dir_name, "testrepo", true)).?; 1370 defer allocator.free(server_path); 1371 1372 var server_repo = try rp.Repo(.xit, .{ .is_test = true }).init(io, allocator, .{ .path = server_path }); 1373 defer server_repo.deinit(io, allocator); 1374 1375 // add config 1376 try server_repo.addConfig(io, allocator, .{ .name = "core.bare", .value = "false" }); 1377 try server_repo.addConfig(io, allocator, .{ .name = "receive.denycurrentbranch", .value = "updateinstead" }); 1378 try server_repo.addConfig(io, allocator, .{ .name = "http.receivepack", .value = "true" }); 1379 1380 // export server repo 1381 { 1382 const export_file = try server_repo.core.repo_dir.createFile(io, "git-daemon-export-ok", .{}); 1383 defer export_file.close(io); 1384 } 1385 1386 const client_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "client" }); 1387 defer allocator.free(client_path); 1388 1389 var client_repo = try rp.Repo(repo_kind, .{ .is_test = true }).init(io, allocator, .{ .path = client_path }); 1390 defer client_repo.deinit(io, allocator); 1391 1392 var client_dir = try cwd.openDir(io, client_path, .{}); 1393 defer client_dir.close(io); 1394 1395 { 1396 const hello_txt = try client_repo.core.work_dir.createFile(io, "hello.txt", .{ .truncate = true }); 1397 defer hello_txt.close(io); 1398 try hello_txt.writeStreamingAll(io, "hello, world!"); 1399 try client_repo.add(io, allocator, &.{"hello.txt"}); 1400 } 1401 1402 // copy files from current repo into client dir 1403 for (&[_][]const u8{"src"}) |dir_name| { 1404 var src_repo_dir = try cwd.openDir(io, dir_name, .{ .iterate = true }); 1405 defer src_repo_dir.close(io); 1406 1407 var dest_repo_dir = try client_dir.createDirPathOpen(io, dir_name, .{}); 1408 defer dest_repo_dir.close(io); 1409 1410 try copyDir(io, src_repo_dir, dest_repo_dir); 1411 1412 try client_repo.add(io, allocator, &.{dir_name}); 1413 } 1414 1415 _ = try client_repo.commit(io, allocator, .{ .message = "let there be light" }); 1416 1417 // change the files so git will send them as delta objects 1418 for (&[_][]const u8{"src"}) |dir_name| { 1419 var dest_repo_dir = try client_dir.createDirPathOpen(io, dir_name, .{ .open_options = .{ .iterate = true } }); 1420 defer dest_repo_dir.close(io); 1421 1422 { 1423 var iter = dest_repo_dir.iterate(); 1424 while (try iter.next(io)) |entry| { 1425 switch (entry.kind) { 1426 .file => { 1427 const file = try dest_repo_dir.openFile(io, entry.name, .{ .mode = .read_write }); 1428 defer file.close(io); 1429 var writer = file.writer(io, &.{}); 1430 try writer.interface.writeAll("EDIT"); 1431 }, 1432 else => {}, 1433 } 1434 } 1435 } 1436 1437 try client_repo.add(io, allocator, &.{dir_name}); 1438 } 1439 1440 const commit2 = try client_repo.commit(io, allocator, .{ .message = "more stuff" }); 1441 1442 // add remote 1443 { 1444 const remote_url = try remoteUrl(transport_def, allocator, "testrepo", port); 1445 defer allocator.free(remote_url); 1446 1447 try client_repo.addRemote(io, allocator, .{ .name = "origin", .value = remote_url }); 1448 try client_repo.addConfig(io, allocator, .{ .name = "branch.master.remote", .value = "origin" }); 1449 } 1450 1451 const is_ssh = switch (transport_def) { 1452 .file => false, 1453 .wire => |wire_kind| .ssh == wire_kind, 1454 }; 1455 1456 if (shell_out_to_git) { 1457 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); 1458 defer allocator.free(priv_key_path); 1459 const ssh_config_arg = try std.fmt.allocPrint(allocator, "core.sshCommand=ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o IdentityFile={s}", .{ port + 1, priv_key_path }); 1460 defer allocator.free(ssh_config_arg); 1461 1462 // shell out to git so it will send delta objects 1463 var process = try std.process.spawn(io, .{ 1464 .argv = if (is_ssh) 1465 &.{ "git", "-c", ssh_config_arg, "push", "origin", "master" } 1466 else 1467 &.{ "git", "push", "origin", "master" }, 1468 .cwd = .{ .path = client_path }, 1469 .stdin = .ignore, 1470 .stdout = .ignore, 1471 .stderr = .ignore, 1472 }); 1473 const term = try process.wait(io); 1474 if (term != .exited or term.exited != 0) { 1475 return error.GitCommandFailed; 1476 } 1477 } else { 1478 const ssh_cmd_maybe = try sshCommand(is_ssh, allocator, cwd_path, temp_dir_name, port); 1479 defer if (ssh_cmd_maybe) |ssh_cmd| allocator.free(ssh_cmd); 1480 1481 try client_repo.push( 1482 io, 1483 allocator, 1484 "origin", 1485 "master", 1486 false, 1487 .{ .wire = .{ .ssh = .{ 1488 .command = ssh_cmd_maybe, 1489 } } }, 1490 ); 1491 } 1492 1493 // make sure push was successful 1494 { 1495 const oid_master = (try server_repo.readRef(io, .{ .kind = .head, .name = "master" })).?; 1496 try std.testing.expectEqualStrings(&commit2, &oid_master); 1497 1498 const hello_txt = try server_repo.core.work_dir.openFile(io, "hello.txt", .{}); 1499 defer hello_txt.close(io); 1500 } 1501 } 1502 1503 fn copyDir(io: std.Io, src_dir: std.Io.Dir, dest_dir: std.Io.Dir) !void { 1504 var iter = src_dir.iterate(); 1505 while (try iter.next(io)) |entry| { 1506 switch (entry.kind) { 1507 .file => try src_dir.copyFile(entry.name, dest_dir, entry.name, io, .{}), 1508 .directory => { 1509 try dest_dir.createDirPath(io, entry.name); 1510 var dest_entry_dir = try dest_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1511 defer dest_entry_dir.close(io); 1512 var src_entry_dir = try src_dir.openDir(io, entry.name, .{ .access_sub_paths = true, .iterate = true, .follow_symlinks = false }); 1513 defer src_entry_dir.close(io); 1514 try copyDir(io, src_entry_dir, dest_entry_dir); 1515 }, 1516 else => {}, 1517 } 1518 } 1519 } 1520 1521 // the dev SSH public key matching the private key written by runServer 1522 const admin_ssh_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKeIs8mJqigBZ5y84J4COgnAJJ5bHPKy+lM2SliMXbYm radar@roark"; 1523 1524 // create the admin event repo with a user holding the dev SSH public key 1525 fn setupAdmin(io: std.Io, allocator: std.mem.Allocator, data_dir_name: []const u8) !void { 1526 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1527 defer allocator.free(cwd_path); 1528 1529 const admin_repo_path = try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "admin" }); 1530 defer allocator.free(admin_repo_path); 1531 1532 var repo = try rp.Repo(.xit, evt.admin_repo_opts).init(io, allocator, .{ .path = admin_repo_path }); 1533 defer repo.deinit(io, allocator); 1534 1535 try repo.addConfig(io, allocator, .{ .name = "user.name", .value = "haxy" }); 1536 try repo.addConfig(io, allocator, .{ .name = "user.email", .value = "admin@haxy" }); 1537 1538 var prng = std.Random.DefaultPrng.init(std.testing.random_seed); 1539 const user_id = evt.EventWithId.randomId(prng.random()); 1540 1541 var password_hash_buf: [evt.User.password_hash_max_len]u8 = undefined; 1542 const password_hash = try evt.User.hashPassword("password", &password_hash_buf, io); 1543 1544 try evt.consume(.xit, evt.admin_repo_opts, io, allocator, &repo, evt.events_ref, &[_]evt.EventWithId{.{ 1545 .id = std.fmt.bytesToHex(user_id, .lower), 1546 .author = .{ .name = "admin", .email = "admin@example.test" }, 1547 .event = .{ .user = .{ 1548 .name = "admin", 1549 .email = "admin@example.test", 1550 .password_hash = password_hash, 1551 .ssh_keys = admin_ssh_key, 1552 } }, 1553 }}); 1554 } 1555 1556 // resolve admin/<repo_name> to its on-disk directory under <data_dir>/repos via 1557 // the event store 1558 fn repoOnDiskPath( 1559 io: std.Io, 1560 allocator: std.mem.Allocator, 1561 data_dir_name: []const u8, 1562 repo_name: []const u8, 1563 create: bool, 1564 ) !?[]u8 { 1565 const cwd_path = try std.process.currentPathAlloc(io, allocator); 1566 defer allocator.free(cwd_path); 1567 1568 const admin_repo_path = try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "admin" }); 1569 defer allocator.free(admin_repo_path); 1570 1571 const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, "admin", repo_name, create)) orelse return null; 1572 return try std.fs.path.join(allocator, &.{ cwd_path, data_dir_name, "repos", &event_id_hex }); 1573 } 1574 1575 // build the remote URL addressing admin/<repo_name> over the given transport 1576 fn remoteUrl( 1577 comptime transport_def: net.TransportDefinition, 1578 allocator: std.mem.Allocator, 1579 repo_name: []const u8, 1580 port: u16, 1581 ) ![]u8 { 1582 return switch (transport_def) { 1583 .file => unreachable, 1584 .wire => |wire_kind| switch (wire_kind) { 1585 .http => try std.fmt.allocPrint(allocator, "http://localhost:{}/admin/{s}", .{ port, repo_name }), 1586 .raw => try std.fmt.allocPrint(allocator, "git://localhost:{}/admin/{s}", .{ port, repo_name }), 1587 .ssh => try std.fmt.allocPrint(allocator, "git@localhost:admin/{s}", .{repo_name}), 1588 }, 1589 }; 1590 } 1591 1592 // the ssh command the haxy git client should invoke, or null when not using 1593 // ssh. haxy generates a fresh host key on every run, so accept the unknown host 1594 // and skip writing to known_hosts. 1595 fn sshCommand( 1596 is_ssh: bool, 1597 allocator: std.mem.Allocator, 1598 cwd_path: []const u8, 1599 temp_dir_name: []const u8, 1600 port: u16, 1601 ) !?[]u8 { 1602 if (!is_ssh) return null; 1603 1604 const priv_key_path = try std.fs.path.join(allocator, &.{ cwd_path, temp_dir_name, "key" }); 1605 defer allocator.free(priv_key_path); 1606 1607 return try std.fmt.allocPrint(allocator, "ssh -p {} -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -o IdentitiesOnly=yes -o IdentityFile=\"{s}\"", .{ port + 1, priv_key_path }); 1608 } 1609