Sending CTRL-D to a Shell

How would I go about sending the “CTRL-D” command to a Shell instance?

I believe this is what the Shell.Canonical property is for.

have you tried sending send chrb(4) ?

From Windows I use this to close the remote shell:
shell.WriteLine(chr(3)) and then shell.close

chr(3) is ctrl-C but its roughly the same idea

Yes your are right :). Here is a link to a list with all the Ctrl keys: http://academic.evergreen.edu/projects/biophysics/technotes/program/ascii_ctrl.htm

Paul was spot on . Completely overlooked the Canonical property. Once enabled, you can send CTRL-D with Text.FromUnicodePoint(&h0004) as Norman suggested.

Thanks.

I can’t determine a normal use for a shell when Canonical is not a good idea. I’ve added a new feature request for it to be true by default instead of false. This is one of those kind-of obvious settings like setting the default for Shell.Timeout to -1 instead of 2000.
Sure, allow the developer to change it, but the largest percentile of use cases would be no timeout and canonical to true.

<https://xojo.com/issue/46587>

BTW - here’s the feedback for the timeout default change request:

<https://xojo.com/issue/32971>

[quote=309357:@Tim Jones]setting the default for Shell.Timeout to -1 instead of 2000.
Sure, allow the developer to change it, but the largest percentile of use cases would be no timeout and canonical to true.[/quote]

Width mode 0, the app can get frozen indefinitely with -1.

@Michel Bujardet - we’re stepping a bit off topic (my fault), but that’s an instance when changing it for your purposes back to a reasonable timeout value would be () and should be) left up to the developer. Especially since it’s a better idea to use a mode 1 or 2 shell and check things as they progress. With mode = 0, you ONLY have the errorcode available. By adding steps in code to monitor the process (even a simple one), you can better notice, control, and resolve such a “forever” process scenario.

Tim, I am afraid you expect a tad too much from people with less expertise. For once I am on the side of preventing people to shoot themselves in the foot.

[quote=309357:@Tim Jones]I can’t determine a normal use for a shell when Canonical is not a good idea. I’ve added a new feature request for it to be true by default instead of false. This is one of those kind-of obvious settings like setting the default for Shell.Timeout to -1 instead of 2000.
Sure, allow the developer to change it, but the largest percentile of use cases would be no timeout and canonical to true.

<https://xojo.com/issue/46587>[/quote]

Enabling this by default will break code. It does with two of my apps that uses the shell
If this suddenly was changed by Xojo, it can break code and it would be hard to pinpoint why your code suddenly doesn’t work anymore.

Hi Christoph - please describe your use when Canonical breaks your shell operations. I’m truly interested because I use shell operations on all 4 platforms and I can’t see how setting canonical would cause issues (since that is on by default in every shell I’ve ever used). I’m wondering what I’ve missed.

What is a canonical shell? For any shell operations I have needed so far I never used a canonical shell.