Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
heckj committed Dec 31, 2024
1 parent bab3073 commit 6c9e2c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Sources/Formic/Commands/VerifyAccess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public struct VerifyAccess: Command {
env: nil,
debugPrint: false)
} else {
answer = try await invoker.localShell(cmd: ["echo", "'hello'"], stdIn: nil, env: nil, chdir: nil, debugPrint: false)
answer = try await invoker.localShell(
cmd: ["echo", "'hello'"], stdIn: nil, env: nil, chdir: nil, debugPrint: false)
}
if answer.stdoutString != "hello" {
return CommandOutput(returnCode: -1, stdOut: nil, stdErr: "Unable to verify access.".data(using: .utf8))
Expand Down
4 changes: 2 additions & 2 deletions Sources/Formic/DependencyProxies/CommandInvoker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct ProcessCommandInvoker: CommandInvoker {
task.currentDirectoryURL = URL(fileURLWithPath: chdir)
}
task.arguments = cmd

if debugPrint {
print(task.arguments?.joined(separator: " ") ?? "nil")
}
Expand Down Expand Up @@ -186,7 +186,7 @@ struct ProcessCommandInvoker: CommandInvoker {

args.append(localPath)
args.append("\(user)@\(host):\(remotePath)")

// loose form:
// scp -o StrictHostKeyChecking=no get-docker.sh "docker-user@${IP_ADDRESS}:get-docker.sh"
let rcAndPipe = try await localShell(cmd: args)
Expand Down
6 changes: 3 additions & 3 deletions Tests/formicTests/CommandInvokerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ func invokeRemoteCommandWithChdir() async throws {
.timeLimit(.minutes(1)),
.tags(.integrationTest))
func invokeRemoteCommandWithTilde() async throws {
// let shellResult = try await ProcessCommandInvoker().remoteShell(
// host: "127.0.0.1", user: "heckj", identityFile: "~/.orbstack/ssh/id_ed25519", port: 32222, chdir: "..",
// cmd: "mkdir ~/.ssh", env: nil)
// let shellResult = try await ProcessCommandInvoker().remoteShell(
// host: "127.0.0.1", user: "heckj", identityFile: "~/.orbstack/ssh/id_ed25519", port: 32222, chdir: "..",
// cmd: "mkdir ~/.ssh", env: nil)
let shellResult = try await ProcessCommandInvoker().remoteShell(
host: "172.190.172.6", user: "docker-user", identityFile: "~/.ssh/bastion_id_ed25519", chdir: nil,
cmd: "mkdir -p ~/.ssh", env: nil)
Expand Down

0 comments on commit 6c9e2c9

Please sign in to comment.