Hi All,
I've written a simple c program that reads stdin, adds highlighting to
particular words and outputs the result to stdout.
I invoke it as follows (where xil-highlight is my program):
build | xil-highlight
I'm using this within a make file. The problem is, if the build part
fails, the exit status is not picked up by make and does not exit.
Is there some way I can 'read' the exit status of build and forward that
to the exit status of my xil-highlight program.
Thanks
Andy 5 1908
In article <g6**********@n etty.york.ac.uk >,
Andrew Greensted <aj****@ohm.yor k.ac.ukwrote:
>I've written a simple c program that reads stdin, adds highlighting to particular words and outputs the result to stdout.
>I invoke it as follows (where xil-highlight is my program):
build | xil-highlight
>I'm using this within a make file. The problem is, if the build part fails, the exit status is not picked up by make and does not exit.
That is not a C issue; it is a make issue or a shell issue.
>Is there some way I can 'read' the exit status of build and forward that to the exit status of my xil-highlight program.
Not within standard C, not without using operating-system specific
extensions. The C language knows nothing about multiple programs
or pipes.
Either your C program xil-highlight will not get started or it
will get started but will detect EOF when 'build' has nothing to send it.
Your C program should not have to depend upon finding the status of
'build'.
--
"Every intellectual product must be judged from the point of view
of the age and the people in which it was produced."
-- Walter Horatio Pater
Andrew Greensted <aj****@ohm.yor k.ac.ukwrites:
I've written a simple c program that reads stdin, adds highlighting to
particular words and outputs the result to stdout.
I invoke it as follows (where xil-highlight is my program):
>build | xil-highlight
I'm using this within a make file. The problem is, if the build part
fails, the exit status is not picked up by make and does not exit.
Is there some way I can 'read' the exit status of build and forward
that to the exit status of my xil-highlight program.
Try comp.unix.shell .
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
On 28 Jul 2008 at 14:46, Andrew Greensted wrote:
I invoke it as follows (where xil-highlight is my program):
build | xil-highlight
I'm using this within a make file. The problem is, if the build part
fails, the exit status is not picked up by make and does not exit.
Is there some way I can 'read' the exit status of build and forward that
to the exit status of my xil-highlight program.
If you're using bash as your shell, try
build | xil-highlight ; [ ${PIPESTATUS[0]} = 0 ]
I don't believe this is portable across POSIX, and you may need to
specify the SHELL variable explicitly in the Makefile if it calls bash
in sh mode by default.
Thanks all for your help.
Cheers
Andy
On Jul 29, 9:28 am, Antoninus Twink <nos...@nospam. invalidwrote:
If you're using bash as your shell, try
build | xil-highlight ; [ ${PIPESTATUS[0]} = 0 ]
I don't believe this is portable across POSIX, and you may need to
specify the SHELL variable explicitly in the Makefile if it calls bash
in sh mode by default.
Lol, the king of wrong non-portable answers,
starts talking about portability. Post of the week. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: user |
last post by:
How can I get the exit status from a "popen2" pipe?
For example, from
child_stdout, child_stdin, child_stderr = popen2.popen3(command)
how can I tell what the exit status it?
Want to find out if a command actuall succeeded.
|
by: Ishwar Rattan |
last post by:
Here is a piece code (according to blurb on os.wait, the lower
order 7 bits of exit status of process should contain the signal
number of signal that terminated the process..) and signal number
should be 8 (SIGFPE), similar logic in C-code produces expected
result.
Any pointers?
-ishwar
----
|
by: Lynn |
last post by:
I am rewriting some memory management code and I need to have a forward
declaration of a data structure. I am not converting this data structure into a
class (yet). How do I generate a forward reference of a data structure ? For
a class, I just say:
class SomeClass;
"struct SomeStructure;" does not work to forward declare the data structure.
This is the structure that I am trying to generate a vector of pointers to:
|
by: Peter Sands |
last post by:
Hi,
I am testing out some restores to a stand-by server, by roll-forwading
the logs.
I have this setup.
There is no user-exit, but logretain is on, for archive logging.
I have 2 DB's on different servers ( a & b), but named the same.
I have done a 'restore into' to create the db on server b, then taken
a on-line dump of that DB, then done a restore, to bring it into a
roll-forward pendind mode.
|
by: drose0927 |
last post by:
Please help! I can't get my program to exit if the user hits the
Escape button:
When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this
error:
Parse Error, expecting `'}''
'else if (choice == 27) exit(0) } }'
Here is my program (Simple loop to display currency equivalencies based
| |
by: Jeffrey W. Baker |
last post by:
I just noticed something unexpected when using psql. I had written a
shell script to bulk-load some hundreds of files into a database, and
move each file to success/ or failure/ directories depending on the exit
status.
The problem is psql exit status differs depending on if the SQL script
is provided with -c or on STDIN. Try this for example:
$ echo "your mom" | psql
ERROR: syntax error at or near "your" at character 1
|
by: Atanas Banov |
last post by:
i ran onto this weirdness today: seems like close() on popen-ed
(pseudo)file fails miserably with exception instead of returning exit
code, when said exit code is -1.
here is the simplest example (under Windows):
>>> print popen('exit 1').close()
1
>>> print popen('exit -1').close()
Traceback (most recent call last):
|
by: iker.arizmendi |
last post by:
On UNIX one can use popen* to get a pipe for reading, a pipe for
writing, and the exit code of the child process via a call to close()
on the last pipe. Is there any way, in principle, to simulate such
behaviour on Windows? Some googling reveals that direct use of the
popen* functions on Windows will not do the trick, but are there
indirect ways?
Regards,
Iker
|
by: GinTon |
last post by:
Is the same use _sys.stderr.write('error message'); sys.exit(1)_ than
_sys.exit('error message')_ ?
Note: help(sys.exit)
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system exit
status will be one (i.e., failure).
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |