4,812
questions
0
votes
1
answer
20
views
Pipe stdout to program that only reads from file
I have two programs P (producer) and C (consumer). P can be run in such a way that writes to stdout. But C is a legacy program that only reads from a file on disk. As in ./C -f </path/to/file>.
...
0
votes
1
answer
20
views
PBS Pro custom stdout stderr filenames
I would like to know how to append jobID to the custom stdout file names. I don't like the default option of jobname.o and jobname.e in PBS Pro. USing SLURM, I could just define stdout filenames and ...
0
votes
0
answers
27
views
no stdout when running an npm script from within vscode
When I run an NPM script from the commandline like this
npm run myscript
it works fine.
vscode shows all scripts in the explorer view.
If I run the same 'myscript' by clicking this script in the ...
0
votes
0
answers
46
views
Reading from stdout blocks using subprocess
new.py
print("Gib number")
x = input()
print('numba is ', x)
launcher.py
import subprocess as sp
p = sp.Popen(['python', 'new.py'], stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE, text=...
5
votes
3
answers
155
views
How can I write a happy birthday message in Ruby to put on a cake? [closed]
Original Question
My boyfriend is celebrating his birthday shortly and I am ordering a custom cake for him. I want to write Happy Birthday on it in a clever Ruby coding way. It will be on a black ...
0
votes
0
answers
34
views
Powershell access output of currently running exe
Is it possible in Powershell to capture the live output of a running exe in order to log and/or manipulate it as the process runs?
Context
I have an exe that runs for quite a while (oiiotool for those ...
1
vote
1
answer
71
views
How to capture ProcessStartInfo stdout as a string for comparison, with Powershell?
I'm getting the output of
T h i s a c t i o n i s o n l y v a l i d f o r p r o d u
c t s t h a t a r e c u r r e n t l y i n s t a l l e d .
and would like to test for that ...
0
votes
0
answers
34
views
How to portably write stdout as if piped through `less`? [duplicate]
I'm working on a Python project which is supposed to spit out output onto stdout. In some cases, the output can be quite long. In such situations, I'd like it if the output wasn't just dumped onto ...
0
votes
0
answers
39
views
Sending stdout to pts and terminating process that generates that stdout on user input to the pts
Really wasn't sure whether to post this in on the Unix SE or here but here goes:
I was trying to get fancy with the asciiquarium package (https://github.com/cmatsuoka/asciiquarium), trying to make it ...
0
votes
0
answers
43
views
Communicate current output stream before terminating subprocess
On Windows, I am terminating Popen subprocess if it runs too long.
Is there any way to collect output and error stream before kill is invoked?
I create a sample child process which prints number 0 to ...
0
votes
0
answers
51
views
How to test a function that does write!, by sending a Vec<u8> in with Box<dyn Write>
I'd like to have a function that either writes to stdout or to a Vec. This is for an interactive CLI I would like to write tests for.
This works:
// To stdout
write!(std::io::stdout(), "{}", ...
3
votes
0
answers
57
views
Why is stdout behaving unbuffered by default? (mingw-w64 gcc) [duplicate]
I've been doing some exercises with printing to streams in C.
Today I've been a bit confused: as I understand in most implementations of the C standard library, the default behaviour of stdout is ...
1
vote
0
answers
35
views
Keeping ainput prompt as last console line
(python >= 3.7)
I'm currently writing a library that extends functionality for guilded.py (discord.py-esque library) to the console.
One problem I'm currently having is keeping the prompt as the ...
0
votes
2
answers
60
views
Problems with the python libraries speedtest/speedtes-cli and tkinter when using cx_freeze
I have written a script to perform a number of broadband speed tests using python/tkinter and the speedtest libraries (speedtest/speedtest-cli). The program works as expected when run as a normal ...
0
votes
0
answers
33
views
Github CLI: repo counts without details
The --limit option of gh has an upper value limit. This is set to reasonable values, and for understandable reasons; as discussed here.
It can be convenient to format the output of gh as JSON, and ...
0
votes
0
answers
12
views
Why does `process.stdout.write` sometimes split lines in `pm2 log` output and how can I ensure atomic output?
I use process.stdout.write in the output of the program so that the output is in one line.
See this example:
while(true) {
process.stdout.write("X");
process.stdout.write("Y");
...
0
votes
0
answers
30
views
Python unit test captured stdout not changing
I am writing an interpreter in Python 3.12 and my module currently outputs using Python's print function.
The interpreter module can take a file name as an input. The given file is some code in the ...
0
votes
1
answer
41
views
Redirect stdout and stderr streams of a thread
I am building a cli tool where application would perform multiple tasks by spawning threads. One of these threads would handle the rendering of state of application. The way rendering works is simply ...
0
votes
0
answers
18
views
Send SSH input when output string is detected on windows from python
My company requires a passcode when SSHing to a server:
ssh myserver
Enter a passcode or select one of the following options:
Passcode:
I want call SSH in the background from a GUI so want to detect ...
0
votes
1
answer
28
views
How to prepend data to stdout without overwriting existing data?
I am trying to implement a console chat system. After connecting its supposed to ask for input() in a while True loop, receive messages and so print them. An example of the workflow:
Received: hello
...
0
votes
0
answers
20
views
How can I rederict output to screen and file witout adding delays? [duplicate]
I have an executable producing some output (stdout and stderr). I want to log it in a file and at the same display it in the terminal.
I'm using the following code:
my_executable 2>&1 |
tee ...
0
votes
0
answers
45
views
Capturing stdout from InteractiveConsole.compile
I have the following code:
from code import InteractiveConsole
from io import StringIO
from contextlib import redirect_stdout
cons = InteractiveConsole()
code = cons.compile("2")
f = ...
0
votes
0
answers
37
views
How does it work to ignore the redirects of stdout and stderr and write directly to console?
How does ssh ignore the redirect and write anyways to the console?
.\ssh.exe [email protected] -p 1022 -v > test.log 2>&1
Output shown on windows console (perhaps the same under linux?):
The ...
0
votes
1
answer
86
views
How to suppress stdout within a specific python thread?
I want to be able to suppress any print to stdout within a specific thread. Here is what I have tried:
import sys, io, time
from threading import Thread
def do_thread_action():
# Disable stdout
...
0
votes
0
answers
44
views
No stdout using a venv with a gui interface
I have a python script that reads a file that represent some parameters from a system (temperature, pressure...). I am trying to create a visual interface that enables a user to start this script ...
1
vote
0
answers
80
views
How do I capture STDOUT of a shared C library, instead of printing just before exit?
I am calling a C library from Python, and trying to capture the library's STDOUT. My current approach is based on https://stackoverflow.com/a/17954769/3077823 with this code:
fd = sys.stdout.fileno()
...
0
votes
0
answers
14
views
Console screen import/export error when using freopen
Can anyone tell me that when using freopen, sometimes when I call new functions using input and output commands on the console screen, it doesn't work? When running, it still works and still processes ...
0
votes
0
answers
35
views
How to replicate the dynamic stdout of a command? [duplicate]
I am working on a Raspberry Pi OS, and I make this Python script to run a command and capture it's output. It works fine for commands that outputs text in a sequential way. But when I try to run ...
1
vote
1
answer
86
views
How can I read from neovim's stdin, using rust?
I'm pretty new to rust and I thought I could get some help here.
I'm trying to follow a guide about making LSPs from TJ DeVries, he is coding it in Go but I'm trying to follow along in Rust. I'm stuck ...
0
votes
1
answer
42
views
Is there a "2> dev null" style way to redirect *some* messages but not specific others?
Running Linux. I have a script I wrote that calls a local TTS engine called "Piper". The script runs well and outputs two types of messages to the console - the info passed by Piper about ...
0
votes
1
answer
53
views
Bash - Log timestamp of the moment data was received on stdin, coming from a pipe
I have an application that outputs to stdout from time to time - random intervals, random durations of outputting before going silent again. Its output (binary data) is captured into a file.
I want to ...
2
votes
1
answer
103
views
Tee only STDERR in Powershell without red text
I am using powershell to run a program (pyinstaller) writes all of its progress output to STDERR. I want the output of this command to be both printed on to the console AND saved to a file.
First, I ...
1
vote
1
answer
78
views
Catpture output of Linux command `needrestart`
I'm trying to capture the output of Linux command needrestart, but I'm having no luck...
After intensive googling, I would expect the following to work:
root@NASLG2:/home/erik# needrestart 2> /home/...
0
votes
0
answers
42
views
How do I make PowerShell register interactive prompts as output when being ran as a subprocess?
I need to be able to capture the prompts of interactive commands and redirect them to the user of my reverse shell.
I have tried using various PTY crates. However, most are oriented to unix systems. ...
0
votes
0
answers
62
views
Getting the output of a command executed inside a pty?
Background
I am developing a reverse shell in rust. I am using a PTY in order to create the sense of interactivity.
The crate i'm using is called portable_pty.
Their documents are pretty scarce, and ...
0
votes
1
answer
46
views
How to properly escape/quote the output so it's treated as an escaped input? [duplicate]
I've been trying to create a set of aliases or functions, that I can use in conjunction with file operating commands.
The idea is to have 1, 2, 3 functions/aliases that will return latest, second-to-...
0
votes
0
answers
41
views
Docker logs in Docker Python SDK: Distinction between `stdout` and `stderr` in correct order
I'm using Docker SDK for Python.
I need to stream the logs from my docker container for logging.
Currently I do this:
stream = container.logs(stdout=True, stderr=True, stream=True)
for line in stream:...
0
votes
0
answers
70
views
Subprocess with .Popen returning empty stdout
I'm trying to write a code that allows me to terminate a calculation that is potentially stuck and doesn't respond to keyboardinterrupt. I solved it with subprocesses. However, the code does not ...
0
votes
1
answer
43
views
Redirecting printf output to a file within a namespace in PHP [duplicate]
I am trying to redirect the output of printf to a file. I referred to this post: https://stackoverflow.com/a/3823015/2704265
However, I am working within a namespace:
namespace dnip_ail;
// Redirect ...
0
votes
1
answer
76
views
Writing UTF-16 directly to stdout with fwrite not doing what's expected
I'm trying to figure out how to write to the console in UTF-16 mode directly (without wprintf) as part of a solution to another problem and wanted to do this directly in C first. Here is an example of ...
0
votes
0
answers
74
views
Wait for command completion and capture output in interactive shell with Go crypto/ssh
After piping in a command to stdin after running session.RequestPty() and session.Shell(), there's seemingly no way to tell when that command is either done executing so I can try to parse stdout ...
0
votes
0
answers
99
views
Bun: streaming stdout of spawned subprocess to Response without copying
In my Bun backend, am calling a subprocess which returns a (large) json text on its stdout. This should, without changes, returned in the Response.
I am doing it like this:
const tsv2json = Bun.spawn('...
0
votes
1
answer
80
views
fgets & printf print nothing if i replace the '\n'
This is the file:
this
is
a
sample
of
normal
words
when i try to remove the \n i found that the printf print nothing.
this is my c code:
int main(int argc, char *argv[]) {
FILE *fp;
char buffer[...
0
votes
1
answer
64
views
Problem Capturing output of Google command in PowerShell
I am trying to use GAM (Google Account Management?) to get information in PowerShell. There is a command called 'whatis' that gives me this sort of output when run in the PS terminal...
PS C:\...
0
votes
0
answers
43
views
FFMPEG FDKAAC and Python
Been banging my head against the wall for days on this. I'm writing a python program to take a 48kHz WAV file, convert it to 44.1kHz and encode it to HE-AAC via FDKAAC. FDK cannot convert to sample ...
0
votes
3
answers
110
views
What is the right way of printing non formatted string not ending in new line?
printf("foo: ");
vs
fputs("foo: ", stdout);
As mentioned in the title, the string is not formatted and does not end in a new line (so no puts). I am not sure about overheads and ...
0
votes
0
answers
84
views
Running powershell Script from Python (password decryption)
I am writing a python script to decrypt password by calling Powershell functions:
import subprocess
keypwd = "BoFaTnpCv0XYrVxND8mi"
pwd= "...
0
votes
0
answers
25
views
Reading and writing from pipe after execvp using dup2 [duplicate]
I want to execute a process called "left" which basically gets 2 integer by scanf and prints its sum. So as to get the sum, i redirected the stdout and stdin by using 1 pipe. But scanf doesn'...
0
votes
2
answers
149
views
Is it safe to output a NULL char to std::cout?
Even though it is a very little problem, but every time when I need to print out some data in a loop, how to arrange the separating char always annoys me.
For example:
std::set<int> my_data { 1, ...
1
vote
2
answers
113
views
Is there any way to recover from a printf()/puts() error?
Whilst interpreting and transpiling Brainfuck, I have this series of calls to printf()/puts():
while (ip < ops->count) {
Op op = ops->items[ip];
switch (op.kind) {
...