[ANN] aShell 3.0.0, now as two crates: ashell and ashell_safe

aShell is an Ada 2022 library for starting and interacting with OS programs, pipes and pipelines. It is POSIX only (via Florist), has been used on Linux, and is under the ISC license.

declare
   use Shell, Shell.Commands, Shell.Commands.Unsafe;
   Output : constant String := +Output_Of (Run ("ps -A | grep bash | wc"));
begin
   Put_Line (Output);
end;

What’s new

Release 3.0.0 splits the library into two crates, both in the Alire index:

  • ashell holds processes, pipes, directories and Shell.Commands.Unsafe, which runs commands directly from a single task.
  • ashell_safe depends on ashell and adds Shell.Commands.Safe, which lets any task run commands. They are started by a separate spawn server, ashell_spawn_server, which this crate also builds.

Programs which only need Unsafe no longer build the spawn server.

Upgrading

No Ada source needs to change.

  • Programs which only use Unsafe need no changes at all.
  • With Alire, programs which use Safe add the new crate: alr with ashell_safe.
  • Without Alire, add safe/library to GPR_PROJECT_PATH, and with "ashell_safe"; in your project file.
  • The spawn server is unchanged, so one installed from 2.0.x still works.

If you are coming from 1.x, please also read the 2.0.0 notes in the changelog. That release changed how commands report failure, and fixed many hangs and lost results.

The full notes are on the release page. Feedback and bug reports are welcome on GitHub.

2 Likes