Questions tagged [stdout]

The standard output stream (stdout) is the stream where a program writes its output data.

Filter by
Sorted by
Tagged with
1 vote
1 answer
36 views

How check whether a program is running the terminal or in the background?

Hi I am working a go program which gives some output in two ways depending on the execution: It outputs to stdout if it is executed in the terminal It is paired with a keyboard shortcut (eg. CTRL+M) ...
Vignesh Magalingam's user avatar
0 votes
1 answer
30 views

Python Popen Subprocess - interacting with executable not possible until stdin is closed

I am trying to interact with a Commandline Executable, but I am stucked. I would like to print out every line, the .exe is producing to stdout. Until I get "condition" in a line -> then ...
Manuel's user avatar
  • 623
-3 votes
1 answer
66 views

this code prints nothing on intelliJ idea, it didn't even takes user input or anything

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); // Write your code here. ...
Aditya das's user avatar
1 vote
1 answer
54 views

How to run Python code on the host like the 'ansible.builtin.shell' module does for Bash?

Sometimes I cannot use the native Ansible / Jinja2 functions to get what I want, so I go get it via Bash. For example, I had to type yesteday's date in yyyy-mm-dd format, and I found the easisest ...
Tms91's user avatar
  • 3,468
0 votes
1 answer
16 views

Measuring maximum memory while capturing stdout in Python using subprocess

Is there a clean way to measure the maximum memory consumption of a subprocess while still capturing stdout (and ideally setting a timeout) using subprocess in Python? Capturing output and setting a ...
BlueMonkey325's user avatar
0 votes
1 answer
46 views

python how to clear every old print output and replace new content (multiple lines)

Normally if the content can be print only in one line in terminal, flush=True can do it perfectly, but if the length is too long that it takes maybe 2 lines, flush can not clear the first line but the ...
ogios's user avatar
  • 13
1 vote
0 answers
46 views

How to Capture STDOUT from a Docker Container in GitHub Actions using 'docker://'?

I have a custom GitHub Action where I use uses: docker://... to run a Docker container. The STDOUT and STDERR are automatically captured in the action's logs, but I need to capture the STDOUT ...
Garry O Connor's user avatar
0 votes
0 answers
29 views

"read" command does not wok in /bin/sh script

I need to read output of one command into variables. Here is simplified examle: #!/bin/sh echo AAA BBB | read X Y echo $X this echos empty string. Whereas when i use /bin/zsh as shell, it works as ...
Martin Vegter's user avatar
0 votes
1 answer
26 views

Capturing stdout, stderr from a running thread at runtime

I'm trying to capture stdout and stderr from an exec() call at runtime i.e. before it completes. I have wrapped it in a thread under a contextlib context to redirect output but with no success. I'm ...
Francisco Gama T. R.'s user avatar
0 votes
0 answers
21 views

How to access the parent process stdout from a subprocess in Windows?

We have an exe that is run from Python (or we can run a Python file as a subprocess instead of an exe). subprocess.run(["cmd.exe", "/c", {path to exe}, "<", {path to ...
Marcus 123's user avatar
1 vote
0 answers
21 views

systemd/journald: is multi-process stdout handled in a way interleaving cannot happen?

I have a systemd managed service that spans child processes using posix_spawn, and I see the journalctl gracefully shows the output of all processes under a single unit. However, as these are multiple ...
Daniel Vazquez's user avatar
-2 votes
1 answer
25 views

What would make a script to get stdout returns differently on different locations?

import * as path from "https://deno.land/[email protected]/path/mod.ts"; async function getStdout() { const dirname = path.dirname(path.fromFileUrl(import.meta.url)) const cmd = new Deno....
Ooker's user avatar
  • 2,067
1 vote
1 answer
29 views

Using nohup with Julia prints everything out as if it's REPL. Can this be avoided?

Let's say I have a Julia script called myscript.jl. It contains the following code: x = 3 When I call this script using nohup: nohup julia < myscript.jl > out_myscript.log & I get this on ...
duodenum's user avatar
0 votes
0 answers
15 views

Daemon process delayed ouput

I have an executable file odo.elf that I need to start in a daemon process on a Micozed board (Petalinux distribution). Here is the executable to start|stop|restart the daemon #!/bin/sh DAEMON=/mnt/...
finoconv's user avatar
0 votes
0 answers
12 views

Redirect zephyr LOGS statements to host stderr

When executing a zephyr app like a native_posix application is it possible to have LOG statement redirected to stderr, while printk statements goes to stdout ?
gtosto's user avatar
  • 1,391
0 votes
1 answer
30 views

Why isn't my output maintaining integrity after a pipe to a program that takes input from stdin?

My output gets corrupted when I try to pipe some output to another command in the shell. This doesn't happen when I execute the executable alone, or redirect its output to a program that doesn't care. ...
Patrick O'Brien's user avatar
1 vote
2 answers
115 views

Create pipe but read its stdout later

I create pipe for reading (in C using popen) and read its output using fgets - and it works well. But now I need two improvements, and not sure how to proceed - most answers are relatively old, maybe ...
Anonymous's user avatar
  • 573
1 vote
2 answers
54 views

How is restic outputting data to the screen but not to stdout or stderr?

Updating line I have a question about where the output of a certain command is going. I'm using restic as an example of a command that behaves this way. It's the last line of the command that's of ...
Matt's user avatar
  • 9,098
-1 votes
2 answers
67 views

Python logging check if errors occured

I use logging.basicConfig(format='%(levelname)s %(asctime)s %(message)s', level=logging.INFO) to activate logging of INFO and higher logging levels. Is there a possibility to check at the end of my ...
Daniel's user avatar
  • 1
0 votes
0 answers
41 views

java isn't printing string [duplicate]

Well , I am currenty learning Java. But for some reason I don't know why, it's not printng String strs. If I input 42 3.1415 Welcome to HackerRank's Java tutorials! I get this String: Double: 3.1415 ...
Pronay Sarker's user avatar
0 votes
0 answers
19 views

Is it possible to thread-safe redirect logging.StreamHandler()?

For print messages I use: import contextlib def thread_proof_print_capture(thread_number): path = f'path/to/some/dir/thread_{thread_number}.txt' with open(path, 'w') as f: with ...
Natan's user avatar
  • 738
1 vote
1 answer
89 views

Why does the my code output "2467135" instead of "1234567"?

I have a question about the following code. Why is the output of the code becoming 2467135? It first gives the output of my own function, then of the write function, and finally of the printf function....
Emre Temir's user avatar
0 votes
0 answers
64 views

How to thread-safely capture stdout output from a function call?

I have a program that now will get a REST API. Instead of rewriting a bunch of code I thought I would just run the program, capture the prints and put that into a message response. On How to capture ...
Natan's user avatar
  • 738
-1 votes
2 answers
73 views

What is the correct way to configure python output encoding?

I am reading utf-8 encoded text from a csv, doing some parsing, and outputting to a text file. I am outputting to the text file indirectly by using a batch file. Currently I am using print() to ...
henry's user avatar
  • 1
0 votes
0 answers
27 views

How to output stdout logging in a .log file in buildbot

from buildbot.plugins import util, steps, schedulers, worker, changes from buildbot.steps import source, shell from buildbot.changes.filter import ChangeFilter from buildbot.process import factory f = ...
jadajdah's user avatar
0 votes
0 answers
17 views

Redirecting output from R - doesn't seem to work for library(moments)

I'm trying to get a clean output, using the cli (bash). It mainly works - but, for some reason, I can't catch the output from 'library(moments)': (R --slave 2>/dev/null <<@@END ...
Peter Brooks's user avatar
2 votes
1 answer
48 views

Output not visible by writting into std::io::stdout()

I want to use a struct which implement std::io::Write to output contents. I use std::io::stdout() to test, but I cannot see the output contents, even though the buffer write is successful. #[test] fn ...
MezoBlast's user avatar
1 vote
1 answer
54 views

printf skipped after scanf statement [C]

I'm struggling to understand how buffers work in c. I'm trying to create a terminal program that involves the following do-while loop do { system("clear"); /...
Luke__'s user avatar
  • 227
0 votes
1 answer
67 views

Windows API in Rust - How to redirect one console output to another

So I was trying to port a code from C# to Rust that can run a Windows command as another user. I got it working fine, but the problem is I want to redirect the output to current console instead of ...
CSDD's user avatar
  • 339
0 votes
0 answers
33 views

Alternative to capture user raw text input that doesn't invoke Cpython

I'm running input() in a Jupyter Lab notebook on Windows in a Conda environment. The cell in its simplest form I used to debug is like this: %%capture str = input("Input please:") It ...
Mog's user avatar
  • 1
0 votes
1 answer
56 views

How the python interpreter receives and outputs data?

What happens when I write print('Something')? Does the interpreter work directly with the system I / O means, or does it use some kind of system API, which gives information that something needs to be ...
handler404's user avatar
2 votes
2 answers
57 views

How to control the print order from 2 different threads in rust

I'm writing a small program that deploys 2 threads, a sender thread that prompts for user input and a receiver thread that receives the input as a message and prints it out to the standard output. A ...
Shlomo Gottlieb's user avatar
1 vote
0 answers
39 views

Is it still possible these days for a C# program to capture the stdout of a native DLL? [closed]

I have a Console C# application that calls into a native DLL whose output I want to capture. I started off from the solution in this post Redirecting native dll stdout/stderr from within C# but so far ...
eugen_nw's user avatar
  • 147
1 vote
1 answer
24 views

NativeCommandError while trying to combine output streams

Doing a Start-Transcript to capture logs from a node program. After starting the transcript the following command is entered: PS > node . 2>&1 The above program outputs everything to ...
deostroll's user avatar
  • 11.7k
0 votes
0 answers
22 views

how can I print to stdout without the \r in python3 on windows? [duplicate]

I am working on Windows 11 with python3 from activestate and I want to write a python script which prints shell commands to stdout which then could be run on Linux or on windows with cygwin. Printing ...
user333869's user avatar
0 votes
0 answers
38 views

How to access the console screen buffer in c#

I've been trying to find a way to access and edit the c# console screen buffer for a terminal based text editor, and I would rather not have to "redraw" the screen every time I need to ...
Bernard Putnam Sproul's user avatar
0 votes
1 answer
56 views

Redirect stdout/stderr to ncurses window

I'm currently adapting an old C console program to a ncurses application. Many prints are done with printf() or fprintf(stdout,...) calls. I would like to redirect stdout (and stderr) stream(s) to a ...
faku's user avatar
  • 421
1 vote
1 answer
102 views

Docker container - Send log from a process other than main (PID1)

I can see all STDOUTs and STDERRs came from my-container's main/initial process (PID1) are sent to docker logs my-container and the same is valid for any application that is run in this process. For ...
Reza Nooralizadeh's user avatar
0 votes
0 answers
27 views

Resetting process.std.in after using inquirer.prompt()

In the code below, I'm capturing keypress events and it works fine. When the "s" key is typed, it starts a prompt asking for the user name and prints it. The issue is after using inquirer ...
Stephane's user avatar
  • 4,988
0 votes
0 answers
47 views

Is it possible to redirect stdout and stderr in a Visual Studio 2022 native unit test?

I have a large C++ library that I want to run under the VS2022 native unit test framework in order to analyse code coverage for a few test cases. The library writes to stdout and stderr and both the ...
user358795's user avatar
0 votes
0 answers
40 views

Disable ABSL_LOG() prints from C libraries in Python

One of the Python modules I use internally calls a C library interanlly that includes calls to ABSL_LOG(). This pollutes my stdout/err with lots of messages I don't want. I have been trying to ...
Milad's user avatar
  • 4,961
0 votes
0 answers
51 views

(C++) How to have stdout update in real time without affecting stdin

I'm trying to make a simple chat program in the Linux terminal. For simplicity, the "users" are just multiple instances of the terminal on a single machine. However, I don't know how to ...
Patrick O'Brien's user avatar
-1 votes
1 answer
71 views

Stdin, stdout, power function in python

Read four inputs a,b,c,d and print a^b+c^d integers a,b,c,d are given on four separate lines input 3 5 7 9 using stdout i want to print a^b+c^d in python i tried import sys y=[] for x in sys.stdin: ...
sampath meda's user avatar
0 votes
0 answers
57 views

Only last line of output being retrieved from stdout (contextlib, sys.stdout, and capture magic)

I'm trying to capture terminal output to store it elsewhere. Specifically, I'm trying to retrieve the training loss from sklearn.linear_model.LogisticRegression. This is unfortunately not stored ...
neverreally's user avatar
1 vote
1 answer
101 views

How to unbuffer and capture output of LFTP EOF command?

I have the following command to mirror some files with LFTP: unbuffer lftp $PROTOCOL://$URL -u ${USER},${PASS} << EOF > ${LOGSTDOUT} set dns:fatal-timeout never set sftp:auto-confirm yes set ...
mwsmws22's user avatar
  • 127
1 vote
0 answers
68 views

How to check if data written to stdout has been read by other process in Rust? [duplicate]

I am writing a tool that continuously writes data to stdout in Rust, and program#2 will read data from my stdout at a varied frequency. I have to write data at max frequency in order to avoid program#...
nochenon's user avatar
  • 326
1 vote
0 answers
43 views

How redirect the output of the mip CBC solver Python method: model.optimize()?

How redirect the output of the mip CBC solver Python method: model.optimize() ? I want to collect the output as a string or an extern file to then process it. I tried to redirect the output in a ...
ISEVEN's user avatar
  • 31
0 votes
0 answers
54 views

Redirecting output from the Time command

Problem I have a bash script that sets some environment variables before executing a program. That script is also recording the execution time of the program by running it through GNU's time command. ...
DrewAtWork's user avatar
0 votes
0 answers
58 views

Wrap blocking Python function in asyncio with stdout presented as async generator

I want to wrap a blocking function in Python 3.7+ so that it runs async while handling whatever output it produces on stdout asynchronously by a handler (in my case sending them over the network). ...
Mr. Developerdude's user avatar
-1 votes
1 answer
46 views

Python subprocess returns stderr value, but never stdout?

I was trying to automate some work done with scid vs pc chess software. It has commandline version tkscid.exe: https://scidvspc.sourceforge.net/doc/progref.html#game I called that executable with ...
tanler's user avatar
  • 9

1
2 3 4 5
96