Topic "Add a Ctrl+C button: Allow aborting an "interactive command""

Author Message
Guest




Many, many times I accidentally run an "interactive command" in WinSCP's Terminal, only noticing it's an "interactive command" after everything freezes up. I'd like a "Send Ctrl+C" button (or just let pressing Ctrl+C work). I want it to send Ctrl+C to the server, not do whatever the "Abort" button does.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Ctrl-C does not have the functionality you want, unless TTY is on for the session. And WinSCP has to have it off.
_________________
Martin Prikryl
Guest




I'm talking about SFTP, it already "starts another session" for the Terminal. So that 2nd session should already be isolated. Can you send Ctrl+C in that case? Somehow you are able to send text to the server...each command one after the other. I do understand the Terminal/Console inside WinSCP is limited, but I don't understand exactly how limited.

Without aborting that session, I can "get out" of this frozen situation, but opening another WinSCP & Terminal/Console, then doing "ps U user", then "kill <pid>" of the interactive process. So perhaps, if you can't "send keys" or "send Ctrl+C" to that 2nd session, you could allow opening another session on top of it, so I can issue kill.

I'm just trying to think if there's any way to over come this. Are there any Docs/Info on how you are currently doing it/what the limitations are?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Anonymous wrote:
I do understand the Terminal/Console inside WinSCP is limited, but I don't understand exactly how limited.

Try to connect with PuTTY with Don't allocate a pseudo-terminal enabled. You will see what is possible and what not.

Quote:
Without aborting that session, I can "get out" of this frozen situation, but opening another WinSCP & Terminal/Console, then doing "ps U user", then "kill <pid>" of the interactive process. So perhaps, if you can't "send keys" or "send Ctrl+C" to that 2nd session, you could allow opening another session on top of it, so I can issue kill.

Isn't it easier to abort the session?
_________________
Martin Prikryl
Guest




prikryl wrote:
Try to connect with PuTTY with Don't allocate a pseudo-terminal enabled. You will see what is possible and what not.

...I believe when I do that, I can't even type commands, at all. So something is different between that & whatever WinSCP does/can do. WinSCP can send commands (aka type commands), it just can't fully connect the TTY input/output. Since it can send text-based commands (somehow!), I figured it could send "the Ctrl+C character". Somehow, WinSCP knows to "wait for the command prompt to return" (cuz if it don't return in 15 secs you get that Abort msg)...so perhaps just make it "not wait" & lemme send another command, like kill or Ctrl+C.

I think I plan on reading the source, if for no other reason, than to try to understand why it can't do these things. The answer might be in the source download, but if not, I'll go ahead & ask: What do you use to compile WinSCP? Can it compile with MinGW? LOL, I just searched: How to compile winscp?...so you can't compile with MinGW...& I will "See readme file in source code archive."...but why didn't you just mention, in that topic, what you can compile with instead of just saying "No, you can't compile with this or that or that". But in any case: Why can't you compile with MinGW? That seems to be the best/easiest Freeware Windows Compiler. Do you mean it "doesn't work with MinGW out-of-the-box" or "it can't ever work/compile with MinGW"? Oh no: more searching has posts talking about "Borland C++ 6.0 Enterprise"...do I really need a payware compiler to compile a freeware program??? why oh why??? Just to show I've really been searching, I found this in history_old for version 3.7: "WinSCP can be now compiled using Personal edition of Borland C++Builder 6.". I guess "Personal Edition" means there's a "free" version of that payware compiler, but: Would it not be worth it to ween WinSCP off the Borland compiler & onto MinGW or GCC? Yes, I know changing the compiler would be a lot of work...but I think it would be good (in the long-run) to head in that direction. WinSCP is open source freeware & should not depend on a half-payware compiler. Can you make a topic (or Doc page) about what all in the source is dependent on BC++ builder? Is there any specific Doc page about "Compiling"...or is that info just in the readme of the source download? Something I found while searching mentioned a "drag & drop library" where the author wouldn't allow you to post source without his permission, but his website doesn't exist anymore, so you can't get his permission...is that still the case or any updates on that issue? Can't you just call it "his loss"? -- he didn't maintain his website, you can't contact him, so just release it & see if he contacts you to complain. How did you get his source anyway? He had to know people would use it...maybe, at the time, he just wanted to know if people were using it? It was probably a long time ago, before open source was so common. That or find an actually open source library to replace it with. Can you post where the website was or any more info you know about it (name of the library) or him (his name). Perhaps post any copyright msgs at the top of his source? We need to either find him or at least do something. WinSCP needs to be open source, that people can actually compile.

prikryl wrote:
Isn't it easier to abort the session?

...no & yes...no, I don't like to fully Abort the session, cuz then I have to login again, but yes, since I already have to login twice to open a new WinSCP & Console, then it would be easier to Abort & login once. I just wanna make absolutely sure there is not some way to regain control, other than fully Aborting. Also, when I Abort, sometimes WinSCP will get really irritated & do "Invalid Access to Memory" or even crash/close. Which means I lose any new commands I typed in the Console recent commands list (it appears to only save/update that list on a clean close), so sometimes doing those steps to recover, in the long way I do it, is the best solution, if I wanna save my new recent Console commands, that were typed in the now-stalling window.

About the logging twice thing: Can I ask for a pref (or point me to it if I missed it) to ALWAYS open the "Console session" when opening the "Main session"...I wanna open BOTH (at the beginning of the session) by typing the password once.

Note: I hope you don't take offense to anything in this msg, I get started on an issue & then I run with it, sometimes I might not word stuff in the nicest way (tho I try). Are my posts helpful at all or just me rambling? Have you ever seen such long posts?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Anonymous wrote:
...I believe when I do that, I can't even type commands, at all.

Maybe your shell or something cannot deal with absence of TTY. Or you actually can type commands, just that you do not see it? Have you tried entering a command blindly and pressing enter?

Quote:
Since it can send text-based commands (somehow!), I figured it could send "the Ctrl+C character". Somehow, WinSCP knows to "wait for the command prompt to return" (cuz if it don't return in 15 secs you get that Abort msg)...so perhaps just make it "not wait" & lemme send another command, like kill or Ctrl+C.

Neither is possible.

Quote:
but why didn't you just mention, in that topic, what you can compile with instead of just saying "No, you can't compile with this or that or that".

There's readme file in the source code package.

Quote:
Can you make a topic (or Doc page) about what all in the source is dependent on BC++ builder?

Almost everything. Sorry, this is something what is not worth discussing at all.

Quote:
I just wanna make absolutely sure there is not some way to regain control, other than fully Aborting.

I'm not aware of any.

Quote:
Also, when I Abort, sometimes WinSCP will get really irritated & do "Invalid Access to Memory" or even crash/close.

Can you reproduce this easily? Is it worth trying to debug it?

Quote:
About the logging twice thing: Can I ask for a pref (or point me to it if I missed it) to ALWAYS open the "Console session" when opening the "Main session"...I wanna open BOTH (at the beginning of the session) by typing the password once.

This request is tracked already:
http://winscp.net/tracker/show_bug.cgi?id=80
_________________
Martin Prikryl
Guest




Anonymous wrote:
...I believe when I do that, I can't even type commands, at all.

...I was a little confused. After I posted, I tested, the behavior I described, not being able to type commands at all, happens when you check "Don't start a shell or command at all" which I confused with your recommendation of "Don't allocate a pseudo-terminal"...you are right, when I use that 2nd option, I can type commands, just not interactive commands & Ctrl+C seems to not work. Neither does any of the "Special Commands" in the PuTTY system menu, like SIGINT, SIGTERM, SIGKILL...not sure what those "Special Commands" are for, but they seem useless, with TTY or not.

prikryl wrote:
Neither is possible.

...OK, how about this: I've been planning on writing a PHP/CGI script to do the "ps U <username>" or even "pstree <username>"...so I can list the processes for my username & click on them to kill them...would this be possible in WinSCP? A "kill window"...open a window that would list processes under your username (by running some command) & allow you to kill them? WinSCP could open "another session" to handle this. Is there a reason you only have "main session" & "secondary session"? What about unlimited (or many) "secondary" sessions?...or just "main", "secondary", "emergency"...the "emergency session" would be used to issue kill commands for un-freezing the 2nd session.

prikryl wrote:
Can you reproduce this easily?

...yes, but I need to try with newer versions 1st. I've only used WinSCP 3.8.2 (1st version I downloaded) & WinSCP 4.1.9...both are now old, but I will test & reproduce with those, then test again with something newer & report. Basically, just open the main session, open the 2nd session, type an interactive command, so it freezes, then Abort it & reconnect, repeat this until it crashes. Should only take 1 or 2 Aborts/Reconnects to crash 3.8.2 or 4.1.9.

prikryl wrote:
Is it worth trying to debug it?

...yes, of course. But hopefully in all those interim versions it could've been fixed.

prikryl wrote:
This request is tracked already...

...um, OK, it was the 80th bug tracked...are you planning on doing it?
Guest




Anonymous wrote:
Also, when I Abort, sometimes WinSCP will get really irritated & do "Invalid Access to Memory" or even crash/close.
prikryl wrote:
Can you reproduce this easily?
Anonymous wrote:
...yes, but I need to try with newer versions 1st.

...I have now tested with 4.2.8 (no not the "most recent stable" {4.2.9} or even the "current beta" {4.3.1}, but newer none-the-less).

Steps to reproduce...tested on WinSCP 4.2.8...

  1. Connect to a server
  2. Click toolbar button: "Open Terminal (Ctrl+T)"
  3. Type any interactive command (I used "nslookup"), press Enter
  4. Wait for "Abort" window, click Abort
  5. Click Reconnect (or wait for timeout)
  6. Get Error msg: "Can't end transaction, not in transaction", click OK.
  7. "Terminal" window closes, you are returned to file list/main window
  8. Click toolbar button: "Open Terminal (Ctrl+T)"
  9. Type any interactive command (I used "nslookup"), press Enter
  10. Wait for "Abort" window, click Abort
  11. Click Reconnect (or wait for timeout)
  12. This time, it seems to reconnect fine, however...
  13. Type any command (interactive or not...I used "nslookup"), press Enter
  14. Get Error msg: "Invalid access to memory", click OK.
  15. Repeat step 13, keep getting error in step 14, stop repeating when bored.
  16. Close Terminal window, since it seems useless/broken.
  17. Terminal window closes, returned to main window, however...
  18. Get Error msg: "Abnormal program termination", click OK.
  19. All of WinSCP closes.
Bug - Forum: Why is the above list, a numbered list, not indented as far as bulleted lists?

Examples...

    List with no bullets or numbers
  • List with bullets
  1. List with numbers
...all of those should be indented at the same level, but they aren't on this forum (they are on other phpBB forums)...or to phrase that another way: the word "List" in all of those above should line-up & the bullets or numbers should be indented some, not left aligned with normal text.

Also, on this forum only, I need to add a blank line before a list or it's "smooshed together"...

Smooshed...
    ...with list
1 blank line away...

    ...from list
...also note there is way too much space after lists, this is more apparent with nested lists...

Nested List...

  • Level 1
    • Level 2
      • Level 3
...after nested list. This line is waay to far below, but looks fine on other phpBB forums. Hrm? Now I'm confused, in preview that looks fine, but I was sure this forum was doing that...was this fixed recently?

Anyway, ignoring the "Nested List" issue (that I can't reproduce right now), look at the "Examples..." above...there is a large blank line between each example, now look at the post's source, they are smooshed as close as I can get them to remove space, however the space remains.
Guest




Have you tried my "Steps to reproduce" above?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Anonymous wrote:
Have you tried my "Steps to reproduce" above?

Not yet, I have it on TODO list Smile
_________________
Martin Prikryl
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
I to have fixed the above problem. Can you send me an email, so I can send you back a debug version of WinSCP to test? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.
_________________
Martin Prikryl
Guest




prikryl wrote:
...so I can send you back a debug version of WinSCP to test?

...I never meant to ignore this post (I read it a while ago, but never replied), but as you can see, I haven't registered on this forum yet.

I was wondering, is this fix in 4.3.2 or are you waiting for me to test the debug version?

Could you possibly just link to a beta/debug version here?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Well, actually the fix might be included. Though it is not listed in the release notes as I didn't receive any confirmation from you. So can you try to reproduce it with 4.3.2?
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License