|
From: <di...@us...> - 2011-06-11 16:07:29
|
Revision: 757
http://safekeep.svn.sourceforge.net/safekeep/?rev=757&view=rev
Author: dimi
Date: 2011-06-11 16:07:23 +0000 (Sat, 11 Jun 2011)
Log Message:
-----------
Try to run ionice and make sure that it works before
we try to use it. This should take care of system where
we don't have enough privileges to run ionice(1), and
we still want to proceed.
Modified Paths:
--------------
safekeep/trunk/safekeep
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2011-06-11 15:59:08 UTC (rev 756)
+++ safekeep/trunk/safekeep 2011-06-11 16:07:23 UTC (rev 757)
@@ -918,13 +918,20 @@
if ionice and ionice != 'none':
ionice_out = try_to_run(ionice_cmd, '-h')
if ionice_out is not None:
+ ionice_args = []
if ionice is 'idle':
- args.extend([ionice_cmd, '-c3'])
+ ionice_args.extend(['-c3'])
else:
- args.extend([ionice_cmd, '-c2', '-n%s' % (ionice)])
+ ionice_args.extend(['-c2', '-n%s' % (ionice)])
if ionice_out.find('-t') > 0:
- args.extend(['-t'])
+ ionice_args.extend(['-t'])
+
+ if try_to_run(ionice_cmd, ionice_args + ['/bin/true']) is not None:
+ args.append(ionice_cmd)
+ args.extend(ionice_args)
+ else:
+ warn('ionice(1) fails, ignoring ionice.adjustment')
else:
warn('ionice(1) not available, ignoring ionice.adjustment')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|