Skip to content

Commit 95e229d

Browse files
author
Axel Soll
authored
Sync and display process names before umount. (#116)
* Test ignoring copy fail. * Sync before unmounting. * Sync before each unmount. * Print running processes before umounting everything. * Fix ps all * Make sure that all the qemu processes dead before umount. * Force kill processes and unmount. * "Graceful" force exit. * Nice print for killing processes.
1 parent c96144a commit 95e229d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/common.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,13 @@ function unmount_image() {
201201
force=$2
202202
fi
203203

204+
sync
204205
if [ -n "$force" ]
205206
then
206-
for process in $(sudo lsof $mount_path | awk '{print $2}')
207+
for pid in $(sudo lsof -t $mount_path)
207208
do
208-
echo "Killing process id $process..."
209-
sudo kill -9 $process
209+
echo "Killing process $(ps -p $pid -o comm=) with pid $pid..."
210+
sudo kill -9 $pid
210211
done
211212
fi
212213

0 commit comments

Comments
 (0)