Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8098385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:03:58+00:00 2026-06-05T22:03:58+00:00

I use os.system to run a make command os.system(‘make -C mydir/project all’) I’d like

  • 0

I use os.system to run a make command

os.system('make -C mydir/project all')

I’d like to see if make fails or not. The system documentation states that the return code is in the same format as wait()

Wait for completion of a child process, and return a tuple containing its pid 
and exit status indication: a 16-bit number, whose low byte is the signal number 
that killed the process, and whose high byte is the exit status (if the signal 
number is zero); the high bit of the low byte is set if a core file was produced.

so if make (or another application) returns -1, I have to convert 0xFFxx (I don’t really care about the pid of the called) to -1. After a right shift, I get 0xFF, but I cannot get it to convert that to -1, it always print 255.

So, in python, how can I convert 255 to -1, or how can I tell the interpreter that my 255 is in fact a 8 bits signed integer?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:03:59+00:00Added an answer on June 5, 2026 at 10:03 pm

    Although Ignacio’s answer may be better for this case, a good general-purpose tool for unpacking bytes from specially formatted data is struct:

    >>> val = (255 << 8) + 13
    >>> struct.unpack('bb', struct.pack('H', val))
    (13, -1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use System.Data.Sqlite library, and I'm following the documentation about optimizing inserts
I'm learning how to use System.Configuration in .NET and would like to know if
I use FAR. When run I can change color of text to green(in command
all, I use the below command after creating some files in a specific directory.
We use GNU Make for our system. At the end of our makefiles, we
In Java we use System.setProperty() method to set some system properties. According to this
I need to use system-specific functions, e.g. ftello() (defined in stdio.h as per POSIX
I am trying to use System.Drawing.Drawing2D.GraphicsPath.AddArc to draw an arc of an ellipse starting
In .NET I would use System.Diagnostics.Trace... What would I use in C or C++
I want to use System.Numerics.Complex in an unmanaged PInvoke scenario. Using ILSpy, I noticed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.