Commit 1da6ffee authored by dmknght's avatar dmknght

Only ask kill app if stop success

parent 209ee8d4
Pipeline #1212 canceled with stages
......@@ -58,9 +58,22 @@ proc onClickRun*(b: Button) =
initAskDialog()
createThread(worker, start)
else:
retCode.open()
createThread(worker, stop)
worker.joinThread()
initAskDialog()
#[
Check return code here before ask
1. If user typed password (and it is correct):
return code == 0 -> ask
2. if user cancelled gksudo:
return code == 255. Do not ask
3. error or wrong password ?
return code == 3 for wrong password (3 times)
]#
let stopResult = retCode.tryRecv()
if stopResult.dataAvailable and stopResult.msg == 0:
initAskDialog()
retcode.close()
proc onClickRestart*(b: Button) =
......
import osproc
# import .. / displays / askKill
var retCode*: Channel[int]
proc start*() =
const
command = "gksudo /usr/sbin/service anonsurfd start"
let runResult = execCmd(command)
if runResult == 0:
discard # send notify done
else:
discard # send notify failed
# let runResult = execCmd(command)
discard execCmd(command)
# retCode.send(runResult)
# if runResult == 0:
# discard # send notify done
# else:
# discard # send notify failed
proc stop*() =
const
command = "gksudo /usr/sbin/service anonsurfd stop"
let runResult = execCmd(command)
if runResult == 0:
discard # send notify done
else:
discard # send notify failed
retCode.send(runResult)
# if runResult == 0:
# discard # send notify done
# else:
# discard # send notify failed
proc restart*() =
const
command = "gksudo /usr/sbin/service anonsurfd restart"
let runResult = execCmd(command)
if runResult == 0:
discard # send notify done
else:
discard # send notify failed
# let runResult = execCmd(command)
discard execCmd(command)
# retCode.send(runResult)
# if runResult == 0:
# discard # send notify done
# else:
# discard # send notify failed
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment