From 66bc6ce77d0838568dc6c1fb3d5d6033ce80e8a3 Mon Sep 17 00:00:00 2001
From: Fabian Homborg <FHomborg@gmail.com>
Date: Thu, 24 Jun 2021 18:19:28 +0200
Subject: [PATCH] Try to fix tests for Solaris' ps

---
 tests/checks/jobs.fish | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/checks/jobs.fish b/tests/checks/jobs.fish
index 2f2f7c017..3b591d0a7 100644
--- a/tests/checks/jobs.fish
+++ b/tests/checks/jobs.fish
@@ -1,7 +1,14 @@
 #RUN: %fish %s
 
 # Ensure there's no zombies before we start, otherwise the tests will mysteriously fail.
-set zombies_among_us (ps -o stat | string match 'Z*' | count)
+set -l zombies_among_us
+if not contains (uname) SunOS
+    set zombies_among_us (ps -o stat | string match 'Z*' | count)
+else
+    # Solaris' ps is awkward, I don't know if this actually works
+    set zombies_among_us (ps -o s | string match 'Z*' | count)
+end
+
 [ "$zombies_among_us" -eq "0" ]
 or begin
 	echo "Found existing zombie processes. Clean up zombies before running this test."
@@ -23,7 +30,11 @@ sleep 0.1
 # be gone by the time we get here. Unfortunately, kill from procps on pre-2016 distributions
 # does not print an error for non-existent PIDs, so instead look for zombies in this session
 # (there should be none).
-ps -o stat | string match 'Z*'
+if not contains (uname) SunOS
+    ps -o stat | string match 'Z*'
+else
+    ps -o s | string match 'Z*'
+end
 
 # Verify disown can be used with last_pid, even if it is separate from the pgroup.
 # This should silently succeed.