Is it possible to spawn an application, send commands, expect results, but also 'respawn' the application in case it crashed and continue from the last point? I tried creating procedures for spawning, but I am not able to catch user shell prompt once the application gets closed
handling tcl expect application crash
693 Views Asked by meso_2600 At
1
There are 1 best solutions below
Related Questions in BASH
- When does Bash read heredocs?
- Why `set -o pipefail` gives different output even though the pipe is not failing
- Run an external command within jq to manipulate each values of a particular key
- API key 401 error in .env.development file
- How to "Enable mobile data" on a Huawei E3372 4G USB dongle using a bash script in Windows
- ImageMagick / Bash : pipe ignored(?) when filename format variable used
- MacOS Bash-Script: while read p and echo
- Parse command line arguments and write useful usage message without additional code
- JQ JSON - Values to Array
- why variable substitution is so different?
- postbank_pdf2csv: how to setup with Cygwin in Windows?
- Custom Bash functions & custom statements - Need some advice
- unexpected operator == in square brackets when trying to use gum lib
- How to disable a bash builtin inside a docker container
- Use sed or rename find series of alphabet then replace with with the same alphabet and a dash -
Related Questions in UNIX
- Reading & Writing to the same file from terminal
- `df` command not capturing entire output in perl
- Why is it that when I pass certain directory names to `ls`, sometimes it does not list their contents?
- Detect Mouse Clicks; Terminate Program on Scroll Wheel Movement
- grep expression behaving weird (unix/mac) while reading a conf file
- Unix sub path creation and copy files
- Ignoring folders in The Silver Searcher `ag`
- struct nameidata-Linux Kernel Module
- telegraf service not able to retrieve data using the journalctl commands
- Order of options in Unix sed for editing files in-place
- Trying to echo line variable along with another variable inside a while read loop
- failed to handshake with xxx: authentication error?
- UDP socket client not able to receive data
- Invalid SCA token in unix
- How can I keep randomized UNIX timestamp in specific hour range in SQL?
Related Questions in TCL
- Is there a proper way to "break" out of a switch script and remain in the procedure other than wrapping in a loop?
- Tcl/TK: how to prevent screen tearing?
- Need help on _tkinter.TclError: invalid command name "<!DOCTYPE"
- Is it possible to use function pointers with critcl?
- In Tcl, why do I have to use quotes and curly braces for expr's argument when comparing two string literals?
- What are JCL Alternitives for Embeded Applications?
- sort array of floating point numbers in tcl
- TclOO metaclass classes objects and objdefine
- In Tcl, why is the string length of an empty string 1, not 0?
- exit(EXIT_FAILURE) : the Tcl C API equivalent
- How to decompress the contents of a var to another var?
- namespace ensemble create : limited scope
- why DSR is not working in FANET in NS2 using z=10.0
- anaconda search path ruins tcl package search path
- Tcl package textutil disappeared
Related Questions in EXPECT
- Expect: Any way to match a specific rule only once?
- How can I compress repetitive expect matches with a loop?
- Rsync within expect script: error "No such file or directory"
- Expect sudo - comand
- python playwright expect pytest class
- How can I pass commands to SSH when using expect while it doesn't support using double quotes?
- Wildcard(*) SFTP in an expect script?
- Expect script to iterate through list of files, fetch file and perform local file manipulation
- Can two subprocesses both send messages to stdout inside a Tcl/Expect script?
- Expect script <<sudo - instructions >> doesn't work
- Expect script: How to interrupt (ctrl+c) running script after defined time
- Expect script: How to set return value of a command to a variable and exit from script if the return value is not 0?
- Is it possible to force `expect` to `puts` a string of nulls without a newline?
- Playright loop while condition is met in addition to that keep clicking on refresh button every 10 seconds until locator found
- What is the difference between referencing a HEREDOC and a File when using expect
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
So it sounds like you are doing something like telneting or sshing into a shell then running an application. The application dies or hangs so the prompt does not return so expect does not return and so you are stuck. You will need to use timeout to detect a hang and restart your entire process ( including the spawn). Below is the boiler plate I start with when writing expect scripts. The critical thing to help you resolve your problem is to realize that spawn not only sets the spawn_id but also returns the pid of the spawned process. You can use that pid to kill the spawned process if you get an eof and/or a timeout. My boiler plate kills the spawn process on timeout. The timeout does not bail from the expect loop but waits for the eof before exiting. it also accumulates the output of expect command so on timeout you may be able to see where it dies. The boilerplate is in a proc called run. Spawn the process and pass the pid and the spawn id . Reuse the boiler plate to define other procs that will be the steps. put the procs in a script with a counter between them as shown and repeat. The other answerer is correct that the unless the app restarts where you left off you can need to start from scratch. If it does start from where you left off. make the steps granular enough that you know what command to repeat. and step to start from. BoilerPlate