#C++ Pipe command Emulation works on Linux, not MacOS

16 messages · Page 1 of 1 (latest)

sand kindle
#

I'm trying to write a program that executes the command below:
ps -A | grep <string> | wc -l

On MacOS, the program stalls somewhere after line 45, which reads
cout << "I'm a great-grandchild" << endl;

But when I run into a Linux machine (I ssh into it), it runs perfectly fine.

Why is this?

pine notchBOT
#

When your question is answered use !solved or the button below to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

pliant jackal
sand kindle
#

oh oops my bad, that was a test

pliant jackal
sand kindle
static forum
sand kindle
#

The grey background is Linux output, blue is MacOS

sand kindle
#

using VSCode debugger

static forum
#

You can do that when using gdb via vscode too

sand kindle
#

mm ok, I use clang++ so idk if I'll have to switch entirely

static forum
#

Gdb can debug anything, it doesn’t matter what compiler you used

#

You can also follow forks in lldb if you’re using that

#

Another useful debugging tool is strace