Skip to main content

Suspending and Resuming

Feature Overview: iFlow CLI allows you to suspend (pause) an interactive session and resume it later when you're ready. (Currently only supported on macOS/Linux)

Learning Time: 5 minutes

Prerequisites: Familiarity with basic command-line operations such as ctrl+z and fg.

What Is Suspending and Resuming?

During an iFlow CLI interactive session, you may need to temporarily step away from the current task to handle something more urgent. The suspend and resume feature lets you use standard terminal commands to pause your current iFlow session and pick up right where you left off when you're ready.

This feature relies on the job control capabilities built into most modern shells (such as Bash and Zsh).

Core Operations

OperationCommandDescription
Suspendctrl+zPauses the iFlow process running in the foreground and moves it to the background.
Resumefg or fg %<job_number>Brings a background task back to the foreground. fg resumes the most recently suspended task by default. Use fg %1, fg %2, etc. to resume a specific task.

You can use the jobs command to list all background tasks along with their job numbers.

Workflow

  1. Start an interactive session: Run iflow to enter interactive mode.
  2. Work on a task: Interact with iFlow in the session — for example, run a playbook or ask a question.
  3. Need to step away: Suppose you need to check another file or run a quick command without terminating the current iFlow session.
  4. Suspend the session: Press ctrl+z. The iFlow CLI process will be paused, and you'll be dropped back to your shell prompt.
  5. Do other work: Run any commands you need in the shell.
  6. Resume the session: When you're ready to return to iFlow, type fg.
  7. Continue where you left off: You'll be brought back to the exact point in your iFlow session where you paused.

Use Cases

  • Quick lookups: While conversing with iFlow, you need to quickly check a file's contents or verify some information.
  • Running system commands: You need to run a command (like git status or ls -l) to gather context before continuing your conversation with iFlow.
  • Multitasking: Manage multiple tasks in a single terminal window without opening a new tab for each one.

Example

Suppose you're using iFlow to write code:

  1. Start iFlow:

    iflow

    You enter iFlow's interactive session.

  2. Begin a task:

    >>> "Write a python hello world"

    iFlow starts generating code.

  3. Need to check something: You suddenly realize you should check whether a hello.py file already exists in the current directory.

  4. Suspend iFlow: Press ctrl+z.

    zsh: suspended  iflow

    You're back at the Zsh (or your default shell) prompt.

  5. Check the file:

    ls

    You confirm there's no hello.py in the directory.

  6. Resume iFlow: Type fg.

    fg
    [1] + continued iflow

    You're back in the iFlow session. iFlow restores your previous conversation history and is ready for your next instruction.

This feature makes iFlow CLI more flexible, letting it fit seamlessly into your existing command-line workflow.