fun runCommand(command :String) {
val runtime = Runtime.getRuntime()
var process: Process? = null
var osw: OutputStreamWriter? = null
try {
process = runtime.exec("su")
osw = OutputStreamWriter(process.outputStream)
osw.write(command)
osw.flush()
osw.close()
} catch (ex: IOException) {
Log.d(TAG,"Command Error1 is "+ex)
ex.printStackTrace()
} finally {
if (osw != null) {
try {
osw.close()
} catch (e: IOException) {
Log.d(TAG,"Command Error2 is "+e)
e.printStackTrace()
}
}
}
try {
process?.waitFor()
} catch (e: InterruptedException) {
Log.d(TAG,"Command Error3 is "+e)
e.printStackTrace()
}
}