retrait msg d'erreur

This commit is contained in:
bruno 2022-11-10 21:22:25 -05:00
parent 45a6522e2f
commit ede365af7d
1 changed files with 27 additions and 24 deletions

View File

@ -22,7 +22,7 @@ import std/asyncdispatch
import ../../commun/utils # Joplin utils procedures and types
# from os import sleep
from posix import read, write, fdatasync, close
# from posix import read, write, fdatasync, close
# --==--==--==--==--==--==--==--==--==--==-- #
# TYPE : Setup joplin_ping data
@ -245,8 +245,8 @@ proc get_joplin_notes*(token: string): Future[joplin_notes] {.async.} =
# store json info into an object
var count: int = 1
var epochTime: int
var humanTime: Time
# var epochTime: int
# var humanTime: Time
for nb in joplin_notes_Json["items"]:
j_notes.id.add(nb["id"].getstr)
j_notes.parent_id.add(nb["parent_id"].getstr)
@ -271,8 +271,8 @@ proc get_joplin_note*(token: string, noteid: string): Future[
# Variables
var j_note: joplin_note
var has_more: bool = true
var page: int = 1
# var has_more: bool = true
# var page: int = 1
var url: string
var client = newAsyncHttpClient()
@ -377,10 +377,10 @@ proc get_joplin_tags*(token: string): Future[joplin_tags] {.async.} =
proc get_joplin_cli_token*(): string =
var flagName: string = ""
var flagValue: string = ""
var result = execCmdEx("joplin config api.token")
var resultExec = execCmdEx("joplin config api.token")
if result.exitCode == 0:
let param1 = result.output
if resultExec.exitCode == 0:
let param1 = resultExec.output
let flagSplit = param1.split(" = ")
flagName = flagSplit[0]
flagValue = flagSplit[1]
@ -395,9 +395,9 @@ proc launchProgram(app: string = "", workingPath: string = "", arguments: array[
var p = startProcess(joinPath(workingPath, app), workingPath, arguments)
let pid = p.processID()
var outhdl = outputHandle(p)
var inputhdl = inputHandle(p)
var errhdl = errorHandle(p)
# var outhdl = outputHandle(p)
# var inputhdl = inputHandle(p)
# var errhdl = errorHandle(p)
return pid
# --==--==--==--==--==--==--==--==--==--==-- #
@ -422,40 +422,43 @@ proc joplin_cli_stop*(): int {.thread.} =
# --==--==--==--==--==--==--==--==--==--==-- #
proc joplin_cli_status*(): bool =
var rc = false
var result = execCmdEx("joplin server status")
var resultExec = execCmdEx("joplin server status")
if result.exitCode == 0:
if "Server is not running" in result.output:
echo "Joplin Terminal cli status is down : ", result.output
if resultExec.exitCode == 0:
if "Server is not running" in resultExec.output:
echo "Joplin Terminal cli status is down : ", resultExec.output
rc = false
else:
echo "Joplin Terminal cli status is up : ", result.output
echo "Joplin Terminal cli status is up : ", resultExec.output
rc = true
else:
echo "Error validate joplin terminal status : ", result.output
echo "Error validate joplin terminal status : ", resultExec.output
return rc
# --==--==--==--==--==--==--==--==--==--==-- #
# PROC : start or stop Joplin Terminal
# --==--==--==--==--==--==--==--==--==--==-- #
proc joplin_cli_start_stop*(): int =
var isStart: int = 0
proc joplin_cli_start_stop*(): bool =
var idExec: int = 0
var isStart: bool = false
var sleep_delay_frame: int = 50
var sleep_max: int = 5000
# var sleep_max: int = 5000
if joplin_cli_status() == false:
isStart = joplin_cli_start()
idExec = joplin_cli_start()
while joplin_cli_status() == false:
sleep(sleep_delay_frame)
echo "Joplin client Terminal started: ", isStart
echo "Joplin client Terminal started: ", idExec
isStart = true
else:
echo "Joplin client Terminal is alredy started !"
#if joplin_cli_status() == true:
isStart = joplin_cli_stop()
idExec = joplin_cli_stop()
while joplin_cli_status() == true:
sleep(sleep_delay_frame)
echo "Joplin client Terminal stopped: ", isStart
echo "Joplin client Terminal stopped: ", idExec
isStart = false
return isStart