diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-03 01:17:03 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-03 01:31:07 +0100 |
commit | 7728bad57be566bd86327dc843f8b950d538a2f0 (patch) | |
tree | f60c5dfa2eacf5db556d9f15c218ae438a42b19f /src/extern/runproc.nim | |
parent | b91b64a2d54404c4ead09093c25e0002fbab1881 (diff) | |
download | chawan-7728bad57be566bd86327dc843f8b950d538a2f0.tar.gz |
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 `\'
Diffstat (limited to 'src/extern/runproc.nim')
-rw-r--r-- | src/extern/runproc.nim | 14 |
1 files changed, 13 insertions, 1 deletions
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 |