Hello all! Anyone having recent issues with the Sh...
# ask-community
w
Hello all! Anyone having recent issues with the ShellOperation block and processes? I've had a working flow for the last few months that used ShellOperation to run a command on the command line, then use stdin subprocess to enter a password on the command line, followed by some tasks that required the successful login. This all of a sudden broke last week without us changing anything. A bit of logging shows that the command line/login portion is happening after the tasks attempt to run (And of course fail). my pared down flow is:
Copy code
@flow
async def flow_function():
     await my_function()
     time.sleep(10) #to ensure the CLI commands in my_function finish
     await my_tasks()
This pared down version of my_function which uses ShellOperation (Edited for privacy, but I assure you the actual command line command I use works!)
Copy code
from prefect_shell import ShellOperation
from prefect_shell.commands import ShellProcess

import anyio
import asyncio
import subprocess
import time


async def my_function():
    process: ShellProcess = await ShellOperation(
        commands=[
            f"<command that prompts for a password on the command line using stdin>"  
            
        ],
        stream_output=True,
    ).trigger()

    time.sleep(5) #make sure the password prompt shows up.
    await process._process.stdin.send(bytes("<password>\n", encoding="UTF-8") 
    )
n
hi @Wade Glaser - what version of prefect are you on?
w
@Nate the production deployment is on 2.10.21 from the official prefecthq docker image. Testing locally we've tried updating to 2.14.11 but that has no effect. Also the version of prefect-shell is 0.2.2
n
thanks, do you have the trace from when it failed?
m
We have our google run logs
n
nice, it would helpful to see the logs you have on your failure
m
This should have everything removed. We believe the crash happens because of a VPN connection. We are trying to figure out why the connection itself does not seem to work in cloud but does locally