This commit is contained in:
parent
4087b6e596
commit
00571d8091
20
runner/jt.sh
Executable file
20
runner/jt.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# JSON=$(cat <<'EOF'
|
||||
# {"command":"nano","args":["-w","./hello.txt"]}
|
||||
# EOF
|
||||
# )
|
||||
|
||||
JSON=$(cat <<'EOF'
|
||||
{"command":"nano","args":["-w","./hello.txt"],"ssh":{"host":"localhost","user":"j","key":"auto"},"options":{"interactive":true},"env":{"TERM":"xterm-256color"}}
|
||||
EOF
|
||||
)
|
||||
|
||||
|
||||
BASE64=$(echo -n "$JSON" | base64 -w0)
|
||||
echo "JSON: $JSON"
|
||||
echo "Running command..."
|
||||
build/runner "$BASE64"
|
||||
|
||||
|
@ -424,15 +424,21 @@ int Runner::execute_ssh(
|
||||
}
|
||||
|
||||
if (interactive) {
|
||||
// Request a pseudo-terminal for interactive commands
|
||||
rc = ssh_channel_request_pty(channel);
|
||||
// Request a pseudo-terminal for interactive commands with specific term type
|
||||
const char* term_type = "xterm-256color";
|
||||
rc = ssh_channel_request_pty_size(channel, term_type, 80, 24);
|
||||
if (rc != SSH_OK) {
|
||||
std::cerr << "Error requesting PTY: " << ssh_get_error(session) << std::endl;
|
||||
ssh_channel_close(channel);
|
||||
ssh_channel_free(channel);
|
||||
ssh_disconnect(session);
|
||||
ssh_free(session);
|
||||
return -1;
|
||||
// Fallback to basic PTY request
|
||||
std::cerr << "Warning: Could not set PTY with size, falling back to basic PTY" << std::endl;
|
||||
rc = ssh_channel_request_pty(channel);
|
||||
if (rc != SSH_OK) {
|
||||
std::cerr << "Error requesting PTY: " << ssh_get_error(session) << std::endl;
|
||||
ssh_channel_close(channel);
|
||||
ssh_channel_free(channel);
|
||||
ssh_disconnect(session);
|
||||
ssh_free(session);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user