Executing Shell under 22r3 results in "No Shell available"

In all my years in RB/RS/Xojo, I thought that i’d seem it all - but, 22r3 brings something new to the table. In running a project in the debugger that has been built many times in prior versions, I and now seeing an error reporting “No shell available” and the process hangs beaus emy Do … Loop until Not theShell.IsRuning is always True.

Any ideas?

On macOS 12.6, i7 MBP

I looked in Documentation for a change for 2022r3 but didn’t find. Looks like the possibility of searching for a specific version is gone. @Dana_Brown has this been changed ?

Part of your comment is scrambled, what did you want to type ?

This is in the notes:

The process running in the Shell is killed when the object gets out of scope even if running in asynchronous or interactive modes.

Could that explains your issue ?

Could it be it’s the command you invoke that is returning this as the result? (instead of the Xojo shell itself)?
Can you tell us which command you’re trying to call?

Works fine here on macOS 12 and 13 Ventura.

Can you show your code?

the process hangs because my Do … Loop until Not theShell.IsRuning is always True

Better, can you provide a sample replicating the issue?

1 Like

Wow - Siri dictation botched the heck out of that …

… that I’d seen it all …

… I am now seeing an error …

… the process hangs beaus emy …

… the process hangs because my …

It’s a simple call to cat a file into an array:

theShell.execute "cat """ + theTempFile.NativePath + """"
Loop Until Not theShell.IsRunning

It functions properly 3 or 4 times and then each debug run after that results in “No Shell”.

Also, the issues doesn’t occur in any number of runs using 22r2 with the exact same unchanged project code.

Seems like that sometimes the shell process ends/dies and that’s why you get a “No Shell”, but due to some bug the IsRunning is not set to false. You need to report it.

You can try to workaround it inspecting some other property too, maybe PID = 0?

Loop Until (Not theShell.IsRunning) Or theShell.PID = 0

Also inspect if the event Completed fires even when you get the “No Shell” situation.

Sounds like a bug to me.

Out of curiousity, why are you polling the shell, instead of

It seems like the way you are doing it is unusual.

1 Like

can you try to set the backend to “/bin/zsh” instead of “/bin/bash” ?

Or just try to add handler to the completed event and see if that fires, Shell.IsRunning is probably meant for Sync mode ?

Why don’t you use the events for this purpose ?

1 Like

Because events do not fit the design model for this application (and others). I need a top down flow that is more strictly controlled by a functional flow.

This code has worked properly for more than 14 years with all prior variants of RB/RS/Xojo and the Shell.

I don’t see the need for the polling, either. If you run the Shell in Synchronous mode, it will wait for the ‘cat’ command to finish before continuing to the next line of code.

1 Like

Would closing the shell before quitting help ?

Xojo requests the polling to provide proper events and PROBABLY it is necessary to update some properties to be consulted

Looking at your screenshot, the error code is -1, is this the case when it works or just when it doesn’t work?

theShell.execute "cat """ + theTempFile.NativePath + """"
while theShell.IsRunning and theShell.errorCode <> -1

I think that -1 means “no error code set yet” for asynchronous operations. Because 0 means “Done, no errors”.

Have in mind that the OP says that previous versions checking just shell.IsRunning was enough, now it does not change the state (wrongly saying “forever running”) and no error/success is set (-1)

Seems like that the system breaks internally, ends, but does not set any end state.


And, simple reverting back to 22r2 returns things to normal.

1 Like

I think we have enough info for an Issue Report, because, if it’s not reported, R4 will carry on such behavior. Report it if you don’t, Tim.

Did you explicitly set the shell to bash?