From 7728bad57be566bd86327dc843f8b950d538a2f0 Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 3 Dec 2023 01:17:03 +0100 Subject: pager, container: add text selection/copying * Add select & copy selection functionality to container * Fix bug in generateSwapOutput where output could be misplaced because of zero-width cells * Add fromJSPromise, call runJSJobs in every iteration of the headed event loop * "await" pager actions that output a promise * Change default view source keybinding to `\' --- src/extern/runproc.nim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/extern') diff --git a/src/extern/runproc.nim b/src/extern/runproc.nim index fa1ed9bc..6cad73a0 100644 --- a/src/extern/runproc.nim +++ b/src/extern/runproc.nim @@ -30,7 +30,7 @@ proc runProcess*(term: Terminal, cmd: string, wait = false): bool = term.restart() # Run process, and capture its output. -proc runProcessCapture*(term: Terminal, cmd: string, outs: var string): bool = +proc runProcessCapture*(cmd: string, outs: var string): bool = let file = popen(cmd, "r") if file == nil: return false @@ -40,3 +40,15 @@ proc runProcessCapture*(term: Terminal, cmd: string, outs: var string): bool = if rv == -1: return false return rv == 0 + +# Run process, and write an arbitrary string into its standard input. +proc runProcessInto*(cmd, ins: string): bool = + let file = popen(cmd, "w") + if file == nil: + return false + let fs = newFileStream(file) + fs.write(ins) + let rv = pclose(file) + if rv == -1: + return false + return rv == 0 -- cgit 1.4.1-2-gfad0